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

4 visualizzazioni (ultimi 30 giorni)
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;

Risposta accettata

yanqi liu
yanqi liu il 27 Ott 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 Commenti
messaoudi nada
messaoudi nada il 27 Ott 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 il 28 Ott 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));

Accedi per commentare.

Più risposte (1)

Image Analyst
Image Analyst il 26 Ott 2021
bw=createMask(roI);
bw = bw & I1; % Combine it with the binary blobs from the thresholded face.
props = regionprops(bw,'BoundingBox');
  2 Commenti
messaoudi nada
messaoudi nada il 27 Ott 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 !

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by