Removing the path name of the data when plotting in gnuplot - path

I am relatively new to gnuplot and I am trying to plot some data and save it to a png file for a report. I am running gnuplot from a java-program using exec("gnuplot") but whenever I try to read data from a file and plot it, the plot contains the full path name of the datafile and prints it over part of my plot.
This makes the plot look rather ugly and unfit for my report. Is there a command or something that I can use to remove the path name or do I have to use Photoshop to render it away manually after generating a .png?

The filename is the default title. If you do not want it to be shown, just turn it off:
plot "/path/to/file" notitle

Related

Maxima plots auto save

I am using Maxima and I have a lot of resulting plots that I want to save on drive for other uses (making GIF...etc)
This is what I am looking at:
Is there any code that can autosave the plots instead of having to save it manually one by one?
Thank you in advance.
Well, one approach is to specify a file name in the arguments of plot2d. Then the plot is output directly to the file and it doesn't show up in the GUI. E.g.,
plot2d (sin(x), [x, 0, 10], [png_file, "mysinplot.png"]);
plot2d recognizes png_file, pdf_file, ps_file and svg_file. In each case, ? png_file, etc, will show some info about that.
Note that there isn't any file output flag for GIF output. The closest thing is PNG which is similar to GIF.
I think draw also recognizes different file formats but I don't know about that without searching the documentation.
If you are generating a lot of plots, it might be convenient to automatically generate file names via sconcat, e.g. sconcat("myplot", i, ".png") produces "myplot10.png" when i is equal to 10.

Tesseract does not recognize complete image whereas correctly recognizes part of it?

I have to parse some Lab Reports and I am using Tesseract to extract data from them. I have encountered an issue that Tesseract does not correctly recognize the text if I pass entire page's image. But if I pass a small subsection of page (from Test Report covering the entire table till *****) it is able to read all the text correctly.
In the formal case (when I pass the entire image) it produces some random text output of English words which do not make sense. Part of text is as follows:
Command I ran: tesseract -l eng report.png out
Refierence No : assurcAN, 98941-EU
5:er Nu (SKU) , 95942, 95943
Labelled age gwup “aw
Quamny 20 pweces
Fackagmg pmwosd Yes
Vendor
Manmamurer
But when I pass the subsection, I get accurate results.
What might be the issue here? How do I fix it?
See the sample report image:

setting threshold and batch processing in ImageJ (FIJI) macro

I know this has been posted elsewhere and that this is no means a difficult problem but I'm very new to writing macros in FIJI and am having a hard time even understanding the solutions described in various online resources.
I have a series of images all in the same folder and want to apply the same operations to them all and save the resultant excel files and images in an output folder. Specifically, I'd like to open, smooth the image, do a Max intensity Z projection, then threshold the images to the same relative value.
This thresholding is one step causing a problem. By relative value I mean that I would like to set the threshold so that the same % of the intensity histogram is included. Currently, in FIJI if you go to image>adjust>threshold you can move the sliders such that a certain percentage of the image is thresholded and it will display that value for you in the open window. In my case 98% is what I am trying to achieve, eg thresholding all but the top 2% of the data.
Once the threshold is applied to the MIP, I convert it to binary and do particle analysis and save the results (summary table, results, image overlay.
My approach has been to try and automate all the steps/ do batch processing but I have been having a hard time adapting what I have written to work based on instructions found online. Instead I've been just opening every image in the directory one by one and applying the macro that I wrote, then saving the results manually. Obviously this is a tedious approach so any help would be much appreciated!
What I have been using for my simple macro:
run("Smooth", "stack");
run("Z Project...", "projection=[Max Intensity]");
setAutoThreshold("Default");
//run("Threshold...");
run("Convert to Mask");
run("Make Binary");
run("Analyze Particles...", " show=[Overlay Masks] display exclude clear include summarize in_situ");
You can use the Process ▶ Batch ▶ Macro... command for this.
For further details, see the Batch Processing page of the ImageJ wiki.

Opencv traincascade cannot fill temp stage

So, I have 20 positive samples and 500 negative samples. I created the .vec file using createsample utility.Now, when i try to train the classifier using the traincascade.exe utility, I run into the following error:
I have looked into many solutions given to people who have faced similar issues, but none of them worked.
Things I tried: 1. Increasing the negative sample size 2. Checking the path of the negative(or background images) stored in the Negative.txt file 3. Varying different parameters.
Here is some information regarding the path: My working directory has the following files: 1. Traincascade.exe 2. Positive image folder 3. NegativeImageFolder 4. vec file 5. Negative.txt (file that has path to images in the negative image folder)
My Negative.txt file has the absolute file path for the images in the negative image folder. I also tried changing the file path to the following format:
NegativeImageFolder\Image1.pgm
but didn't work! I tried both front and backslash too!
I have run out of ways to change the file path or make any modification to make this work!
First of all: is NumStages 1 and maxDepth 1 intentional?
Looking at Opencv's source code (cascadeclassifier.cpp, imagestorage.cpp), the error is thrown when in function
bool CvCascadeClassifier::updateTrainingSet( double& acceptanceRatio)
a number, negCount=500, of negative samples cannot be filled.
Before, everything was ok with positive samples (and the line about pos count that was printed on the screen is a proof of this).
Digging deep into source code negCount cannot be filled when imgReader.getNeg( img ) returns false, this means it cannot provide any image, which in turn happens when the list of source negatives is empty.
So you have to concentrate all your efforts in the direction of providing the algorithm with the correct list of negative images.
There are two ways to solve this: make sure that Negative.txt is read and all paths are regular and that every image in the list can be read regularly.
Is the file name “Negative.txt” or “Negatives.txt”?
Anyway with so few positive and negative samples you won’t train anything functioning, it is only useful to make you understand how the process of training works.
Well I was able to resolve the issue and run the train the classifier successfully. However, I am not 100% sure as to how the change I made helped.
This is what I did:
I was generating the Negative.txt file using Excel. I would enter the file path of one image and increment the image filename (since my images were name image1, image2, image3...). So the format as mentioned earlier would be :
C:\OpenCV-3.0.0\opencv\build\x64\vc12\bin\Negative\Image1.pgm
And finally save the file as a Unicode txt document. However, saving it as a unicode txt document gave me the error stated in the question. I saved it as a Text (tab delimited) file and it worked.

Mapping UGC or FIPS6 geocodes to polygons?

I am looking to convert UGC or FIPS6 geocodes to polygons (or even rough lat/lng coordinates + radius). An example of the geocodes can be found here: http://alerts.weather.gov/cap/us.php?x=0
Anybody knows where I could find a mapping for these geocodes?
The data used by the NWS can be found here:
http://www.nws.noaa.gov/geodata/
In order to actually get the coordinates from the data, I used the program OpenJump to save the data in the CSV format.
Updated Answer for June 2019
The NWS Public Forecast Zones can be downloaded as a shapefile from https://www.weather.gov/gis/PublicZones
I used QGIS to convert the shapefile to WGS84 (EPSG:4326) and exported to CSV using WKT geometry. That resulted in a 122MB CSV file.
Instructions for Windows QGIS 3.4.3
Download and extract z_02ap19.zip
In QGIS, Layer -> Add Layer -> Add Vector Layer... (or press Ctrl+Shift+V)
Source Type = File, Encoding = System, Vector Dataset(s) = z_02ap19.shp extracted eariler. Then click Add.
Result
[Optional] Right click the layer, Set CRS -> Set Layer CRS... and set the CRS to EPSG:4326.
Right click the layer, Export -> Save Feature As...
Format = Comma Separated Value [CSV]
Choose a file location.
Choose an encoding, usually System or UTF-8.
Uncheck "Add saved file to map"
Make sure all fields are selected
Geometry type should be Automatic (They all end up as Polygons)
Layer Options:
CREATE_CSVT = YES (Creates a single file that describes the field types, useful for re-importing the file back into other GIS programs)
GEOMETRY = AS_WKT
LINEFORMAT = CRLF (Windows) or LF (Unix), historically, but most programs now can handle both
SEPARATOR = COMMA (Up to you)
STRING_QUOTING = ALWAYS (Likely doesn't matter as the data won't contain quotes anyways)
WRITE_BOM = NO (Byte-order mark, up to you)
Click OK, and QGIS will generated the file which takes several seconds.

Resources