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

조회 수: 1 (최근 30일)
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;

채택된 답변

yanqi liu
yanqi liu 2021년 10월 27일
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
messaoudi nada
messaoudi nada 2021년 10월 27일
@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 2021년 10월 28일
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));

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2021년 10월 26일
bw=createMask(roI);
bw = bw & I1; % Combine it with the binary blobs from the thresholded face.
props = regionprops(bw,'BoundingBox');
  댓글 수: 2
messaoudi nada
messaoudi nada 2021년 10월 27일
@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 !
Image Analyst
Image Analyst 2021년 10월 27일
You've accepted @yanqi liu's answer so I guess you got it all figured out now.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by