dahtah / imager

R package for image processing
GNU Lesser General Public License v3.0
187 stars 43 forks source link

bbox error? #89

Open mconsidine opened 5 years ago

mconsidine commented 5 years ago

I'm trying to get the bbox function to work but get the following error in R Error in bbox(px) : object not a >= 2-column array

The reproducible example is:

im <- grayscale(load.example("parrots")) px <- im> 0.65 plot(im) plot(px) boundary(px) %>% plot bbox(px) %>% highlight(col="yellow")

This happens on a different grayscale image as well. Is there something I am missing here in terms of it's use?

Sys.info() yields

Sys.info() sysname "Linux" release "4.15.0-46-generic" version "#49~16.04.1-Ubuntu SMP Tue Feb 12 17:45:24 UTC 2019" machine "x86_64"

Also, the version of imager loaded is 0.41.2

What I am really shooting for is the bounding box around, for example, a circle that may be randomly placed in the image. Operating on a threshholded image would be fine.

Thanks! mconsidine

dahtah commented 5 years ago

This works fine on my machine. Can you please run?

str(px)

Should be

 'pixset' logi [1:768, 1:512, 1, 1] FALSE FALSE FALSE FALSE FALSE FALSE ...
mconsidine commented 5 years ago

Hi,

This is what I get using the example:

imtest <- grayscale(boats) px <- imtest > .85 plot(imtest) highlight(bbox(px)) Error in bbox(px) : object not a >= 2-column array is(px) [1] "pixset" str(px)  'pixset' logi [1:256, 1:384, 1, 1] FALSE FALSE FALSE FALSE FALSE FALSE ...

Thoughts?

Matt

On 4/11/19 7:45 AM, Simon Barthelmé wrote:

This works fine on my machine. Can you please run?

|str(px) |

Should be

|'pixset' logi [1:768, 1:512, 1, 1] FALSE FALSE FALSE FALSE FALSE FALSE ... |

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dahtah/imager/issues/89#issuecomment-482081281, or mute the thread https://github.com/notifications/unsubscribe-auth/AAj0PIvQSY_YHL7ot-gTxzg4v8FakWkAks5vfyBYgaJpZM4cd9hp.

dahtah commented 5 years ago

It's strange, don't know where that comes from. Maybe step through the function with debugonce? It's a very simple function. Essentially all it does is find the range of x and y coordinates in the set, and output another pixset that contains every pixel in the range.