Manual thresholding cropping [image processing]

Hi. May i know if manual thresholding allows autocropping? where i set T a value, bw = im2bw(J,T);
because usually auto thresholding was done with autocropping. but i was told me to set a value for my image instead of using graythresh.

Risposte (1)

Image Analyst
Image Analyst il 8 Nov 2012
Cropping and thresholding are two totally separate and independent operations. One operation does not need, depend on, allow, or enable the other operation at all. I would not say that autothresholding is usually done with autocropping - not in general, though it may be in some specific situation you maybe referring to, like your co-worker's program. You can use graythresh() if you want to determine a threshold value, though in my experience it seldom selects the best threshold. It seems to work best for high contrast situations where foreground and background are well separated in the histogram (i.e., they have vastly different intensities).

4 Commenti

does using graythresh meant that it determine the threshold itself? because when I used, bw = im2bw(J,T); manual threshold and proceed to autocropping, it actually threw an error.
graythresh() determines a threshold from the image using the famous Otsu method. It's not a gray level but a normalized gray level in the range 0-1. im2bw() also wants a threshold in the range 0-1. If you have a gray level that's uint8, you have to divide it by 255 to get it into the 0-1 range.
I have no idea what you mean by autocropping. Did you use imcrop() or some other method to do autocropping? What is "auto" about it?
Esther
Esther il 8 Nov 2012
Modificato: Esther il 8 Nov 2012
i didn't use imcrop(). but i use method by getting the outmost object border coordinates to crop it out.
You mean like
submatrix = fullMatrix(row1:row2, col1:col2);
? What about this threw an exception?

Accedi per commentare.

Richiesto:

il 8 Nov 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by