bpurinton / PebbleCounts

PebbleCounts: grain-sizing algorithm for gravel-bed river imagery
GNU General Public License v3.0
12 stars 9 forks source link

too many windows in scale 1 of 3 #15

Open masspern opened 4 months ago

masspern commented 4 months ago

running the code Pebblecounts.py, after the selection of filters, in scale 1 of 3 a large number of windows are tested: How can I set manually the window size (or the windows number)??

........
Non-local means filtering
Bilateral filtering
Black tophat edge detection
Canny edge detection
Sobel edge detection

Empty window, skipping

Window 163282 of 12533760

Non-local means filtering
Bilateral filtering
Black tophat edge detection
Canny edge detection
Sobel edge detection

Empty window, skipping

Window 163283 of 12533760
.........
bpurinton commented 4 months ago

From the docs:


image


Can you describe the imagery to me? In particular, it sounds like you might be trying to process very large images in a single go. Rather, the maximum input size for an image should be ~2000x2000 pixels. Can you:

a) Crop the image into 2000x2000 pixel tiles (see scripts here for some ways to do that in Python: https://github.com/UP-RS-ESP/PebbleCounts-Application)?

b) Reduce the image resolution such that the size of the input image is reduced?

masspern commented 4 months ago

My images are 3072 x 4080, but in the example the image is 4000 x 6000..... Anyway I reduce the image to 1305 x 1817 but I still get:

.......
 Window 1075 of 2371185

Non-local means filtering
Bilateral filtering
Black tophat edge detection
Canny edge detection
Sobel edge detection

Empty window, skipping

Window 1076 of 2371185

Non-local means filtering
Bilateral filtering
Black tophat edge detection
Canny edge detection
Sobel edge detection

........

Thank you very much!

bpurinton commented 4 months ago

Can you share a link to an uploaded image somewhere (google drive, dropbox, or you can email it to me at ben.purinton [at] gmail.com)? And can you also share the exact command that you are trying to run (i.e. the full command that is leading to that huge number of windows)?

I will try to debug the issue with those two pieces of information.

masspern commented 4 months ago

Hi, first I used the following:

python calculate_camera_resolution.py -focal 35 -height 1.5 -sensorHW 15 26 -imageHW 1305 1817 Then I used:

python PebbleCounts.py -im test.jpg -ortho y i also tried to change both focal and sensorHW with no results. I'm in a conda environment in windows. Sent the image by email. Thanks!!!!

bpurinton commented 4 months ago

Your test.jpg is not an orthophoto, meaning it is not projected into a coordinate system with the pixels readable in meters on the ground. Rather, what you need to run is something like:

python PebbleCounts.py -im test.jpg -ortho n -input_resolution 0.55

You needed to tell the algorithm that the test.jpg was not an ortho image (-ortho n) and give it the resolution (0.55 mm/pixel), which I read off from your first calculate_camera_resolution.py command.

I was able to run PebbleCounts with that, but I note that the test.jpg image you sent along is a very challenging one for the algorithm:

That said, please do give the algorithm a try! You may want to play around a bit with the command-line flags listed in section 7.4 of the manual, but don't spend a very long time messing with these flags, as the default values usually give you a pretty good idea of how good of results a given image (with given grain and lighting characteristics) will give you.

masspern commented 4 months ago

Oh yes, not an orthophoto!!! Sorry it was easy.... Thank you very much! Now everything works fine!!!! Really really a nice job!!!! Great algorithm!!!

Thanks a lot!!!

Massimo