How to identify a black dot in an RGB Image programmatically and then select a region in rectangle shape nearby to the black dot present in Image?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I want to select a particular region shown in red line with reference to point in the image(shown in black dot). Please refer the attached image.
Kindly Suggest a method to do the same using MATLAB. I need to find out that black spot in the image programmatically and then select the region based on that point present in the image. The selected region can be in the shape of rectangle.
4 Kommentare
Jan
am 22 Jan. 2018
@Ananthu Jayan: Again I have removed your flag. Please stop using flags to catch attraction of readers, because this is not the purpose of flags. Thanks.
I think, you do not get an answer, because this is not clear: "Can I programmatically find the position of the black spot". You did not mention, how the position of the black spot is defined. Then it is impossible to find it by an algorithm.
Explain, what you want to do. Which region do you want to select by which method?
Guillaume
am 22 Jan. 2018
Bearbeitet: Guillaume
am 22 Jan. 2018
With the test image provided, finding the location of the black dot is trivial. That begs the question: why aren't you able to do it yourself? What is the difficulty?
With regards to the region selection, what is the criteria for the size of that region? Is it a user input (again, trivial to do) or is it based on the size of the leaf? (a bit harder but not that hard) or something else?
Antworten (1)
Utkarsh Deshmukh
am 16 Jan. 2018
Try this
img = imread('img.png');
reference_point = [450, 450];
region_height = 200;
region_width = 400;
cropped_region = img(reference_point(1): reference_point(1)+region_height, reference_point(2): reference_point(2)+region_width, :);
by changing the reference point, you can change the top left coordinate. By changing the region_eidth and region_height, you can change the size of the region that you want to crop
3 Kommentare
Jan
am 17 Jan. 2018
This means that your image is smaller than the selected rectangle. Of course you have to adjust the values of Utkarsh Deshmukh's answer.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!