Menampilkan properti dari suatu images

Here is a simple program to display image attributes like width, height, size and etc. This program assumes that you have OpenCV library already installed on you system.

#include
#include
#include “cv.h”
#include “highgui.h”

using namespace std;

int main( int argc, char** argv )

{

// Create an IplImage object *image
IplImage *image = cvLoadImage( argv[1]);

// Display Image Attributes by accessing a IplImage object’s data members

cout << left << setfill(' ') << setw(15) << "Image filename:" << argv[1] << endl;

cout << setw(15) << "Width:" << image->width << endl;
cout << setw(15) << "Height:" << image->height << endl;

cout << setw(15) << "Pixel Depth:" << image->depth << endl;
cout << setw(15) << "Channels:" << image->nChannels << endl;

cout << setw(15) << "Width Step:" << image->widthStep << endl;
cout << setw(15) << "Image Size:" << image->imageSize << endl;

return 0;
}

Related posts:

  1. Mengenal OpenCV dan Pengenalan Wajah OpenCV ialah program open source berbasiskan C++ yang saat ini...
  2. Pengontrol Alat Berbasis Port Paralel Kit ini merupakan aplikasi port parallel sebagai pengontrol alat menggunakan...

Related posts brought to you by Yet Another Related Posts Plugin.