Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract an "unknown" ROI of an image

Problemdescription:

How can I extract any selected object from a given image without knowing the ROI in advance? For instance I have an image (monochrome) of a house where I would like to extract one window (my ROI) and save this ROI temporally to a template. This template needs to be used again for the next loaded image - again with the same house but from a different perspective for example.

Now I do have some difficulties to extract this ROI because is has to be selected automatically without knowing anything about the size, position of it. The only thing which is known is the starting point where the window is located. This starting point can be anywhere inside the window and is not necessarily the center point. 

I did some tests with the "magic wall" which looked promising at the beginning. The problem is that you need to set the tolerance first before you extract the ROI. Otherwise you can not extract the complete window as a whole and it is only a fragment if the tolerance has been set to low level.

 

Question:

Is there a good way or an improved algorithm how I could extract such a ROI in a way that it can be used as a template for further images? In my opinion such a ROI needs to be extracted as a complete part which includes the borders or frame, in case of a window, to retrieve it again in the following image(s) where the house may be in a different position if the observer has moved.

Do I need a completely different algorithm than the magic wall or could I used it in a recursive way until the algorithm finds a transition in  contrast for example to find the edges?

 

Thanks in advance

0 Kudos
Message 1 of 10
(5,845 Views)

A few questions and suggestions

 

1. Is the wall's contrast predominantly different from the house. 

   1.1 If yes then apply the a proper threshold and particle filter to make sure only the window exists. Not you can extract the particle and using the bounding box as the reference.

 

1.2  If no then can you do contrast enhancement and then threshold and continue with the above step?

 

2. What does pattern matching give you (My guess is that it will be in consistent)

 

3. when the window size is changing the overall hpuse size will change? or remain more or less same? or not related? 

 

Message 2 of 10
(5,832 Views)

Hi

pleae see my answers below in red:

 

1. Is the wall's contrast predominantly different from the house. 

   1.1 If yes then apply the a proper threshold and particle filter to make sure only the window exists. Not you can extract the particle and using the bounding box as the reference.

  -> In general there is always a contrast difference between my ROI and the sourrounding environment. Keep in mind that my example with the house and window is just an example. Nevertheless if there is solution to solve "the window problem" I can easaly adapt it to other images I suppose. But how can I apply a propeer threshold if the algorithm has to do it automatically? In other words the algorithm needs to find the complete window size by itself. This means I do not know the optimal threshold in advance! The question is how can I determine the optimal threshold (automatically) to extract the complete window out of my image? Of course it is easy to do it manually but this threshold also differs if there are different houses or light conditions changes.

 

1.2  If no then can you do contrast enhancement and then threshold and continue with the above step?

 -> Yes I can use all filters like contrast enhancement etc. I would need therefore. But again I dont know how to solve it (see answer in 1.1)

 

2. What does pattern matching give you (My guess is that it will be in consistent)

 -> The pattern matching gives me the actual position of my template I extraced.

 

3. when the window size is changing the overall hpuse size will change? or remain more or less same? or not related? 

-> The window size is not changing between the first image where the ROI (window) is extracted and the following images where the ROI (window) will be searched again to define its positon. So it will remain the same.

 

 

best regards

               

 

0 Kudos
Message 3 of 10
(5,808 Views)
Ok so put it simply you want to do adaptive thresholding. You can do this if you are able to quantify the image. Basically you need a reference again for this. The reference can be built by you in a look up table. For example choose a part that will remain constant in the the entire image. The part can be anything. The parts image histogram can be calculated. Using this we can manually see the corresponding manual threshold value. So calculate the histogram, feed the threshold value corresponding to the histogram (Which you should have manually calculated)
0 Kudos
Message 4 of 10
(5,793 Views)
Can you post a few images?
0 Kudos
Message 5 of 10
(5,792 Views)

Hi

attached I have some image examples. As I already mentioned it can be ANYTHING, meaning it also could be the plate number, front shield of a car or even a pedestrian on a street. I choosed randomly this image where I extract one of the windows of the entire image. I would apreciate if you have an example where the adaptive threshold algorithm can be seen as you described.

 

 

thanks in advance

 

 

Download All
0 Kudos
Message 6 of 10
(5,789 Views)
Any ideas muks?
0 Kudos
Message 7 of 10
(5,598 Views)
One thing i can suggest is try "quantifying the image". See if can build a threshold lookup table based on that. Similarly you can find the histogram of the entire image and try relating it to the limits of the threshold.
0 Kudos
Message 8 of 10
(5,594 Views)

Hello Norick,

I have got a similar problem with you. Have you found a method to solve this problem? If so, please tell me how to do it.

Thanks in advance.

 

best regards

Guo Zhongge

0 Kudos
Message 9 of 10
(5,159 Views)
Adaptive thresholding is suggested in your other thread. Please stick to a single thread.
0 Kudos
Message 10 of 10
(5,142 Views)