Octave only prints last line segment plotted - printing

I am having trouble creating plot files with octave. When executing
imagesc([1,2,3],[1,2,3],[1,3,1;3,2,3;1,3,1]);
line([0,1,2,3,4],[1.5,1.3,1.7,1.5,1.9]);
print("test.pdf);
the bitmap image is displayed correctly in the plot window, with a wiggly line superimposed on top. But the .png file only shows the image from "imagesc", plus the last of the four segments drawn by the "line" command. This happens when printing to .png files as well.
I am using octave 4.2.1 on Windows 10, with the "qt" graphics toolkit. Changing toolkits to "fltk" effects no change, while going to "gnuplot" will trigger some error message about the "imagesc" command which I am currently not interested in.
Does anyone know how to get the file output right?

Adding a third dimension to the line coordinates solved my problem. I have implemented the following changes following a workaround found in bug report #51464 on savannah.gnu.org:
imagesc([1,2,3],[1,2,3],[1,3,1;3,2,3;1,3,1]);
line([0,1,2,3,4],[1.5,1.3,1.7,1.5,1.9],[4,4,4,4,4]);
zlim ([0 4]);
print("test.pdf");

Related

Identify rotation of text in pdf document

I have pdf files which have electronical origin, but can be in various layouts. These pdfs include tables, which are sometimes rotated in +90 or -90 degrees. It can sometimes happen, that the first line of the file has the normal orientation (0 degrees), but all other content is rotated.
The metadata of these files do not include the rotation information, rotation is always 0. I need to extract tables from these files with help of https://pdftables.com.
Pdftables was first opensource based on pdfminer python library, now it is a commercial product. What happens when I send these strange pages to pdftables is, that the content can not be read properly. So I need to figure out, the orientation of the page before I send it there.
I tried to extract text with pdfminer by myself and compare it with extraction from unix tool pdftotext (which can extract text properly) and whenever there was a "difference" I would take the file to rotation.
Unfortunately, this does not work always, because pdfminer doesnt give me always the same results as pdftables.
I have tried pythons OpenCV library for images of these pdfs, but this could only recognise the skew of text, not 90 degrees angle.
I have also tried the Hough transform method to find lines from text and estimate their direction, but since there are tables on pages, it is hard to estimate if line is just the text or a real line.
Please, do you have some suggestions, how to solve this problem? Thanks

ImageJ image stack shifted

I have taken images of cells using confocal microscope. When the file size is large, the image stack starts to shift downwards at a later stage. The shifted image just repeats the earlier images. The image stack is fine when i open it with a compatible software (Zen) but i need imageJ to do some editing. The original file is in .lsm format and is around 6GB. Here's a link to my video showing the shifted stack when i open the file in imageJ. Any help would be great. https://1drv.ms/v/s!AnUarFrjoIltl1jZya_GstBiCghC
It looks like you need to use a registration function. Maybe this plugin (http://imagej.net/Name_Landmarks_and_Register) would be the best option, since it would allow you to choose a cell or two that you feel confidently able to identify, and register (line up) the images using those cells as landmarks.

How to get live output while processing images in ImageJ?

All what I am describing here takes place in ImageJ 32-bit version(Java 1.6.0_20).The Plugin I am using to get the capture stream from the camera is Civil Capture.
I made it work that i get image slices in a stack from a live video capture stream, with a camera. Afterwords I process them, lets just say i feed the values of one horizontal line of pixels of one image in an array and than plot this line with the methods from Plot and Plot Window.
So now my Problem:
When I run my plugin it first captures the picture than it gets processed. Now a Window is beeing opend for the Image stack and one for the Plot.
For the next incoming image it will also be processed and the Plot is beeing updated. But only at the end, when as many images, as I want to, were processed, the Plot and the images will actually be displayed. While the processing is happening, both Windows are white and dont show anything.
Is it possible to make ImageJ display the plot and the images after the processing part? and how?
I have found the Dynamik Profiler but I didnt get it to work the way I wanted it to. Especally since you have to input a image and not an array.
This is my first question so dont be too hard on me if i missed to give you information.
You should be able to use ImagePlus#updateAndDraw() to update the image display.
For the Plot class, use:
Plot#show()
to display it for the first time, and:
Plot#updateImage()
to update the plot window.
Solution:
So the problem was that the entier program took place in one thread. So to fix it, the ploting had to be done in a seperat thread.

GNUPLOT generated curves to view in single frame one by one back and forth

I have a lot of data to plot in a single plot window and it looks really ugly and not understandable. Moreover legends are coming on to the curves which make curves unreadable. I cannot put curve alone one by one into my latex report which makes it again difficult to maneuver between the plots.
My question is- can't it be possible to put all the curves in single plot generated from gnu plot which can be easily maneuver back and forth in a single plot window the latex report?
I know a bit about tikz pictures where no of frameworks can be easily accessible in single plot.
can't it be used for a whole curves one by one assuming as different frame work. and at last all the plots in the the plot window.
It would be very helpful if is possible so.
I have data with N rows and M columns in it. I need plots of N rows vs. each column separately to be shown in each frame in Latex generated report and in the last frame all the curves should be present. I need a proper procedure to follow to animate the curves.
Yes, this kind of thing can be done with the animate package in latex. I have successfully used it in the past for presentations that I put together with beamer. You could switch between different gnuplot graphs that are loaded into the animateinline environment, but you can also use pgfplots within tikz to modify the plot directly on your latex document without need for an external plot.
Using animate requires investing a bit of time at the beginning but the results can be very nice. Also, Okular (and I'm guessing other PDF viewers as well) seem to have trouble visualizing the animations but Adobe reader (acroread on linux) loads them without problems.
As an example, you can check a 5-minute presentation I put together last year: in slides 4 and 5 you can use the buttons to run the animation. The one in slide 4 includes plotting a gaussian with pgfplots changing the curve parameters between frames. You need to open it with the Adobe reader for it to play correctly.

Getting the average color of frames in a video

End goal: Get the average colour of each frame in a video.
My plan so far is this:
Export the frames of the video as individual images.
Batch process the images to resize them as 1px x 1px as I believe this will provide the average colour.
Get the RGB value of that one pixel and record it as text.
Where I'm stuck is step 3. I've no idea how one would go about this programmatically.
I only need to do this once or twice, so it doesn't need to be completely automatic, I'm just keen to avoid copy pasting colour values manually.
EDIT: The first two steps don't require any programming so I am pretty open to using whatever language your solution requires. My forte is PHP, and this is for an Arduino project, so C-like languages are fine, but whatever will get the job done. I use a Mac but Windows or Linux also not a problem either.
Since you are doing something with image processing, I assume you are doing this in matlab.
So you can read the image first:
A = imread('filename.jpg');
To get the Red color you can use:
A(1,1,1);
To get Green and Blue just change the index to 2 and 3 respectively in the third column.

Resources