Skip to main content

Posts

Showing posts with the label visual studio 2010

Computing Entropy of an image (CORRECTED)

entropy is a measure of the uncertainty associated with a random variable. basically i want to get a single value representing the entropy of an image. 1. Assign 255 bins for the range of values between 0-255 2. separate the image into its 3 channels 3. compute histogram for each channel 4. normalize all 3 channels unifirmely 5. for each channel get the bin value (Hc) and use its absolute value (negative log is infinity) 6. compute Hc*log10(Hc) 7. add to entropy and continue with 5 until a single value converges 5. get the frequency of each channel - add all the values of the bin 6. for each bin get a probability - if bin 1 = 20 bin 2 = 30 then frequency is 50 and probability is 20/50 and 30/50 then compute using shannon formula  REFERENCE: http://people.revoledu.com/kardi/tutorial/DecisionTree/how-to-measure-impurity.htm class atsHistogram { public:     cv::Mat DrawHistogram(Mat src)     {      ...

Histogram computation on a video

Histograms are collected counts of data organized into a set of predefined bins   refracted class for histogram: given an input image, output the histogram image class atsHistogram { public:     cv::Mat DrawHistogram(Mat src)     {         /// Separate the image in 3 places ( R, G and B )          vector<Mat> rgb_planes;          split( src, rgb_planes );          /// Establish the number of bins          int histSize = 255;          /// Set the ranges ( for R,G,B) )          float range[] = { 0, 255 } ;          const float* histRange = { range };          bool uniform = true; bool accumulate = false;   ...

SURF keypoints using a camera

#include <stdlib.h> #include <stdio.h> #include <math.h> #include <string.h> #include <opencv2/objdetect/objdetect.hpp> #include <opencv2/features2d/features2d.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/calib3d/calib3d.hpp> #include <opencv2/imgproc/imgproc_c.h> #include <opencv2/video/tracking.hpp> #include <iostream> #include <vector> using namespace std; int main(int argc, char** argv) { CvMemStorage* storage = cvCreateMemStorage(0); cvNamedWindow("Object", 1); int key = 0; static CvScalar colors[] = { {{0,0,255}}, {{0,128,255}}, {{0,255,255}}, {{0,255,0}}, {{255,128,0}}, {{255,255,0}}, {{255,0,0}}, {{255,0,255}}, {{255,255,255}} }; CvCapture* capture = cvCreateCameraCapture(0); CvMat* prevgray = 0, *image = 0, *gray =0; while( key != 'q' ) { int firstFrame = gray == 0; IplImage* frame = cvQueryFrame(captur...

Installing and configuring OpenCV 2.2

Correction to the include library correction to the linking of files CODE USED: #include int main() { IplImage* img = cvLoadImage("C:\\hello.jpg"); cvNamedWindow("myfirstwindow"); cvShowImage("myfirstwindow", img); cvWaitKey(0); cvReleaseImage(&img); return 0; } The important files and includes in previous versions of opencv cv200d. lib cxcore200d. lib highgui200d. lib cvaux200d. lib ml200d. lib