HOW CAN I CREATE ROI IN IMAGE WITHOUT CROPPED IT FOR FEATURES DETECTION

1 view (last 30 days)
hellow everyone , i need help please! i want to extract SIFT features in region of intrerest for face so the first step is to create ROI in image and when i tried this code i got the binary image and the binarymask but i don't know how can i find the masked roi ! for features detection , i called regionprops but i don't know how i use it to get roi in my images without cropped it
THANKS IN ADVANCE !
ch=strcat('C:\Users\nada\Desktop\nadamastere\bd\fatigue\p1\image_',num2str(v,'%d'),'.png');
I1=imread(ch);
I1=imresize(I1,[row,colum]);
I1=rgb2gray(I1);
I1=im2double(I1);
I1=im2bw(I1);
figure(2);imshow(I1);
roI=imrect(gca,[20 20 110 120]);
bw=createMask(roI);
figure(3);imshow(bw);
props = regionprops(bw,'BoundingBox');
b =props(1).BoundingBox;

Accepted Answer

yanqi liu
yanqi liu on 27 Oct 2021
ch=strcat('C:\Users\nada\Desktop\nadamastere\bd\fatigue\p1\image_',num2str(v,'%d'),'.png');
I1=imread(ch);
I1=imresize(I1,[row,colum]);
I1=rgb2gray(I1);
im = I1;
I1=im2double(I1);
I1=im2bw(I1);
figure(2);imshow(I1);
roI=imrect(gca,[20 20 110 120]);
bw=createMask(roI);
figure(3);imshow(bw);
props = regionprops(bw,'BoundingBox');
b =props(1).BoundingBox;
% use it to get roi in my images without cropped it
im2 = im .* uint8(bw);
figure; imshow(im2, []);
  2 Comments
messaoudi nada
messaoudi nada on 27 Oct 2021
@yanqi liu thanks so much sir for your help , it work well ! but i have another problem here , my objective is to extract features from ROI , i dont know why the program extract features from background ! is there any way to resolve this problem ? how can i remove this features point from background
yanqi liu
yanqi liu on 28 Oct 2021
clc; clear all; close all
ch = 'cameraman.tif';
row = 256;
colum = 256;
% ch=strcat('C:\Users\nada\Desktop\nadamastere\bd\fatigue\p1\image_',num2str(v,'%d'),'.png');
I1=imread(ch);
I1=imresize(I1,[row,colum],'bilinear');
% I1=rgb2gray(I1);
im = I1;
I1=im2double(I1);
I1=im2bw(I1);
figure(2);imshow(I1);
roI=imrect(gca,[20 20 110 120]);
bw=createMask(roI);
figure(3);imshow(bw);
props = regionprops(bw,'BoundingBox');
b =props(1).BoundingBox;
% use it to get roi in my images without cropped it
im2 = im .* uint8(bw);
% extract features
corners = detectFASTFeatures(im2,'ROI',[20 20 110 120]);
figure; imshow(im2, []);hold on;plot(corners.selectStrongest(50));

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 26 Oct 2021
bw=createMask(roI);
bw = bw & I1; % Combine it with the binary blobs from the thresholded face.
props = regionprops(bw,'BoundingBox');
  2 Comments
messaoudi nada
messaoudi nada on 27 Oct 2021
@Image Analyst thanks sir i did it , but why the features detected from background and not from ROI ? even when i tried to convert image from RGB to YCBCR , the features are detected from background !

Sign in to comment.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!