loading
 
Saving images
Annika from United States  [14 posts]
10 year
Hi again,

I am using a python script to do the following:

LoadImage
LoadProgram which does auto threshold and gets coordinates for cropping
Load original Image
SetVariables based on cropping coordinates
LoadProgram that does the cropping
and finally SaveImage

This all works fine in RoboRealm, and I see exactly what I want to see, but the file that has been saved by the script is the one that has the autothreshold, uncropped, rather than the original image, cropped. What am I doing wrong?
program.robo
Steven Gentner from United States  [1446 posts] 10 year
Annika,

Its hard to say what is going wrong without the python application that you are using to do this.

Based on your robofile, you don't seem to be loading and saving the image from RoboRealm ... can I assume this is happening in the python app? Or did you forget to include additional robofiles?

Note, you don't actually need to reload the image after thresholding, just use the Marker module, type in something like my_thresholded_image in case you want to keep a copy of that and then select Source as the revert to ... that will bring back in the original image.

So you should only need to load in an image once, perform all needed operations and save the image all from within RR. You Python script would then just provide the image and call that robofile.

Or am I not understanding what you want to do?

Perhaps if you include a copy of the original image and mention what you want to crop out we can provide a full robofile that will do that.

STeven.
Annika from United States  [14 posts] 10 year
Okay, that makes a lot of sense to do it in one robofile. Here is an example of what you suggested. Though for some reason the cropping module works when I first input the coordinates, but when I save the image (which yes, I am doing in my python script) it narrows the width of the image. Also, I tried saving with the Write Images module and it does not appear to save the image. I am also uploading the test image so you can see what it does.

  

program.robo
Steven Gentner from United States  [1446 posts] 10 year
Annika,

Thanks for the images. I noticed 2 issues in the robofile:

1. The blob filter had LEFT and AboveY filters but in the second tab. The Main tab is really the one used for processing with the other tabs being used to create variations that are used in the Join or Overlay attributes ... so unless you are doing some very advanced filtering you'd just keep things to the Main tab.

2. Small typo in the Set_Variables. The indexing used in all RR fields is actually BLOBS:0 instead of BLOBS(0) which instead looks like a function to RR. This was not evaluating correctly and causing the start and stop vars to malfunction.

Attached is the correct robofile.

STeven.

program.robo

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index