How to extract features from Bounding box?

Hi, I have bounding box for each training image. I need MATLAB code to extract features from each bounding box. I don't want to extract features from entire image but only from bounding box. Could someone provide me the required code?

Answers (2)

The specifics depend on what features you want to extract. I show examples of area, perimeter, bounding box, etc. In short, extract your bounding box with imcrop, then process it to get a binary image and then label and call regionprops().

8 Comments

Thanks for your kind reply.I am working with car image. So according to your idea I have to crop each bounding box and then make it binary image. right? then do i need to label it for car image?
Yes. For many measurements (like area, perimeter, axis lengths, etc.), though not all, you need to get a binary image. For some you don't, like mean intensity, histogram, GLCM, etc. But we don't know what features you want to measure.
OK. Thanks a lot again. But in my task I am using Contourlet transform to decompose the image. According to your idea after cropping bounding box I will apply Contourlet on the box.Then take features. right? In this case my bounding box size is not same. For Different cars have different sizes box. So my feature dimensions are different. How do I get same dimension feature using different sizes bounding box?
Posting a picture would help me to understand what you're dealing with.
FARHAD
FARHAD on 4 May 2014
Edited: FARHAD on 4 May 2014
Here two images have two different sizes bounding box. I want to apply Contourlet transform on each image to extract features. Now please advice me to extract features. You can tell me according to your idea to extract features. Yet I don't know which features are useful to detect a car.
Looks like a car was already detected in each image. How did you get the yellow boxes otherwise? What information do you need to carry out your task? What is your task? You could measure lots of things in the box, like color, number or length of edges, etc. But more important is what do you need? I mean really need . I mean, why measure things that you don't need to? So let's just measure what you need. To do that we need to know your use case. Let's say that I measured 30 things in the box. Okay, now what? What are you going to do with those 30 measurements in that feature vector (which is what the list of 30 measurements is called)? Just because the detected car box is different sizes doesn't mean that the feature vector has different dimensions or different lengths. It could be 30 measurements long for every single box.

Sign in to comment.

What sort of features? If you mean interest points and local descriptors, then detectHarrisFeatures(), detectFASTFeatures(), detectSURFFeatures(), and detectMSERFeatures() all let you specify an ROI. These functions are in the Computer Vision System Toolbox.

1 Comment

FARHAD
FARHAD on 4 May 2014
Edited: FARHAD on 4 May 2014
But I want to use Contourlet transform. After Contourlet transform Suppose I want to use detectSURFFeatures()to extract features from frequency domain.but in my image bounding box contains positive sample and out of box all are negative. I don't want to extract feature from negative samples but only from positive. So if I extract features from bounding box only then the dimensions are different as boxes are different and I cant resize the box. But I need fixed dimension features. I think you understand my problem. Could you kindly solve it?

Sign in to comment.

Asked:

on 3 May 2014

Edited:

on 4 May 2014

Community Treasure Hunt

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

Start Hunting!