برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی

برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی و

برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی

برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی و

داده هایی در مورد برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی و

تبلیغات
آخرین نظرات

۵۲ مطلب با موضوع «نرم افزار» ثبت شده است

افزایش کنتراست تصویر

ShahBaz | دوشنبه, ۲۵ مرداد ۱۳۹۵، ۰۴:۳۰ ب.ظ
  • void convertTo( OutputArray m, int rtype, double alpha=1, double beta=0 )
This OpenCV function converts  image into another format with scaling. Scaling is done according to the following formula.
                                              m[i,j] = alfa * img[i,j] + beta
Here is the parameters of this function
    • OutputArray m - Store the converted image
    • int rtype - Depth of the output image. If the value of rtype is negative, output type is same as the input image. I have used a negative value in the above program because I don't want to change the depth of the original image. Possible inputs to this parameter
      • CV_8U
      • CV_32S
      • CV_64F
      • -1
Complete list of depths can be found in Basics of OpenCV API
    • double alpha - Multiplication factor; Every pixel will be multiplied by this value
    • double beta - This value will be added to very pixels after multiplying with the above value.
Here is the formula again. Here m[i, j] means a pixel at ith row and jth column.
                              m[i,j] = alfa * img[i,j] + beta

Change the Contrast of a Video

It is similar to the above program except that you have to change the contrast for each and every frame of the video. Here is the example OpenCV program.
 
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
 
using namespace cv;
using namespace std;
 
int main(int argc, char* argv[])
{
    VideoCapture cap("C:/Users/SHERMAL/Desktop/SampleVideo.wmv"); // open the video file for reading
 
    if ( !cap.isOpened() )  // if not success, exit program
    {
         cout << "Cannot open the video file" << endl;
         return -1;
    }
 
    //create windows
    namedWindow("Original Video",CV_WINDOW_AUTOSIZE); 
    namedWindow("Contrast Increased",CV_WINDOW_AUTOSIZE); 
    namedWindow("Contrast Decreased",CV_WINDOW_AUTOSIZE); 
 
    while (1)
    {
        Mat frame;
 
        bool bSuccess = cap.read(frame); // read a new frame from video
 
         if (!bSuccess) //if not success, break loop
        {
cout << "Cannot read the frame from video file" << endl;
break;
        }
 
Mat imgH;
frame.convertTo(imgH, -1, 2, 0); //increase the contrast (double)
 
Mat imgL;
frame.convertTo(imgL, -1, 0.5, 0); //decrease the contrast (halve)
 
//show the image
        imshow("Original Video", frame); 
imshow("Contrast Increased", imgH); 
imshow("Contrast Decreased", imgL); 
 
       if (waitKey(30) == 27) //wait for 'esc' key press for 30 ms. If 'esc' key is pressed, break loop
        {
                cout << "esc key is pressed by user" << endl; 
                break
        }
    }
    return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
You can download this OpenCV visual c++ project from here. (The downloaded file is a compressed .rar folder. So, you have to extract it using Winrar or other suitable software)
 
All the OpenCV methods in the above example program have been discussed in previous lessons. So, I am not going to repeat them again.
 
  • ShahBaz

namedWindow + opencv

ShahBaz | دوشنبه, ۲۵ مرداد ۱۳۹۵، ۰۹:۳۳ ق.ظ

namedWindow

Creates a window.

C++: void namedWindow(const string& winname, int flags=WINDOW_AUTOSIZE )
Python: cv2.namedWindow(winname[, flags]) → None
C: int cvNamedWindow(const char* name, int flags=CV_WINDOW_AUTOSIZE )
Python: cv.NamedWindow(name, flags=CV_WINDOW_AUTOSIZE) → None
Parameters:
  • name – Name of the window in the window caption that may be used as a window identifier.
  • flags

    Flags of the window. The supported flags are:

    • WINDOW_NORMAL If this is set, the user can resize the window (no constraint).
    • WINDOW_AUTOSIZE If this is set, the window size is automatically adjusted to fit the displayed image (see imshow() ), and you cannot change the window size manually.
    • WINDOW_OPENGL If this is set, the window will be created with OpenGL support.

The function namedWindow creates a window that can be used as a placeholder for images and trackbars. Created windows are referred to by their names.

If a window with the same name already exists, the function does nothing.

You can call destroyWindow() or destroyAllWindows() to close the window and de-allocate any associated memory usage. For a simple program, you do not really have to call these functions because all the resources and windows of the application are closed automatically by the operating system upon exit.

Note

Qt backend supports additional flags:

  • CV_WINDOW_NORMAL or CV_WINDOW_AUTOSIZE: CV_WINDOW_NORMAL enables you to resize the window, whereas CV_WINDOW_AUTOSIZE adjusts automatically the window size to fit the displayed image (see imshow() ), and you cannot change the window size manually.
  • CV_WINDOW_FREERATIO or CV_WINDOW_KEEPRATIO: CV_WINDOW_FREERATIO adjusts the image with no respect to its ratio, whereas CV_WINDOW_KEEPRATIO keeps the image ratio.
  • CV_GUI_NORMAL or CV_GUI_EXPANDED: CV_GUI_NORMAL is the old way to draw the window without statusbar and toolbar, whereas CV_GUI_EXPANDED is a new enhanced GUI.

By default, flags == CV_WINDOW_AUTOSIZE | CV_WINDOW_KEEPRATIO | CV_GUI_EXPANDED

  • ShahBaz

کشیدن دایره و خط روی تصویر با opencv

ShahBaz | يكشنبه, ۲۴ مرداد ۱۳۹۵، ۰۷:۲۷ ب.ظ

Basic drawing examples

Drawing a line

void line(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
 Parameters:
  • img – Image.
  • pt1 – First point of the line segment.
  • pt2 – Second point of the line segment.
  • color – Line color.
  • thickness – Line thickness.
  • lineType – Type of the line:
    • 8 (or omitted) - 8-connected line.
    • 4 - 4-connected line.
    • CV_AA - antialiased line.
  • shift – Number of fractional bits in the point coordinates.

Example 1: Drawing a line

-------------
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;

int main( )
{    
  // Create black empty images
  Mat image = Mat::zeros( 400, 400, CV_8UC3 );
  
  // Draw a line 
  line( image, Point( 15, 20 ), Point( 70, 50), Scalar( 110, 220, 0 ),  2, 8 );
  imshow("Image",image);

  waitKey( 0 );
  return(0);
}
-------------

Drawing a Circle

void circle(Mat& img, Point center, int radius, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
Parameters:
  • img – Image where the circle is drawn.
  • center – Center of the circle.
  • radius – Radius of the circle.
  • color – Circle color.
  • thickness – Thickness of the circle outline, if positive. Negative thickness means that a filled circle is to be drawn.
  • lineType – Type of the circle boundary. See the line() description.
  • shift – Number of fractional bits in the coordinates of the center and in the radius value.
The function circle draws a simple or filled circle with a given center and radius.

Example 2: Drawing a Circle

-------------
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;

int main( )
{    
  // Create black empty images
  Mat image = Mat::zeros( 400, 400, CV_8UC3 );
  
  // Draw a circle 
  circle( image, Point( 200, 200 ), 32.0, Scalar( 0, 0, 255 ), 1, 8 );
  imshow("Image",image);

  waitKey( 0 );
  return(0);
}
-------------

Drawing an Ellipse

void ellipse(Mat& img, Point center, Size axes, double angle, double startAngle, double endAngle, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
Parameters:
  • img – Image.
  • center – Center of the ellipse.
  • axes – Length of the ellipse axes.
  • angle – Ellipse rotation angle in degrees.
  • startAngle – Starting angle of the elliptic arc in degrees.
  • endAngle – Ending angle of the elliptic arc in degrees.
  • box – Alternative ellipse representation via RotatedRect or CvBox2D. This means that the function draws an ellipse inscribed in the rotated rectangle.
  • color – Ellipse color.
  • thickness – Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that a filled ellipse sector is to be drawn.
  • lineType – Type of the ellipse boundary. See the line() description.
  • shift – Number of fractional bits in the coordinates of the center and values of axes.
The functions ellipse with less parameters draw an ellipse outline, a filled ellipse, an elliptic arc, or a filled ellipse sector. A piecewise-linear curve is used to approximate the elliptic arc boundary.

If you use the first variant of the function and want to draw the whole ellipse, not an arc, pass startAngle=0 and endAngle=360.

Example 3: Drawing an Ellipse

-------------
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;

int main( )
{    
  // Create black empty images
  Mat image = Mat::zeros( 400, 400, CV_8UC3 );
  
  // Draw a ellipse 
  ellipse( image, Point( 200, 200 ), Size( 100.0, 160.0 ), 45, 0, 360, Scalar( 255, 0, 0 ), 1, 8 );
  ellipse( image, Point( 200, 200 ), Size( 100.0, 160.0 ), 135, 0, 360, Scalar( 255, 0, 0 ), 10, 8 );
  ellipse( image, Point( 200, 200 ), Size( 150.0, 50.0 ), 135, 0, 360, Scalar( 0, 255, 0 ), 1, 8 );
  imshow("Image",image);

  waitKey( 0 );
  return(0);
}
-------------

Drawing a Rectangle

void rectangle(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
Parameters:
  • img – Image.
  • pt1 – Vertex of the rectangle.
  • pt2 – Vertex of the rectangle opposite to pt1 .
  • rec – Alternative specification of the drawn rectangle.
  • colorRectangle color or brightness (grayscale image).
  • thickness – Thickness of lines that make up the rectangle. Negative values, like CV_FILLED , mean that the function has to draw a filled rectangle.
  • lineType – Type of the line. See the line() description.
  • shift – Number of fractional bits in the point coordinates.

Example 4: Drawing a Rectangle

-------------
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;

int main( )
{    
  // Create black empty images
  Mat image = Mat::zeros( 400, 400, CV_8UC3 );
  
  // Draw a rectangle ( 5th argument is not -ve)
  rectangle( image, Point( 15, 20 ), Point( 70, 50), Scalar( 0, 55, 255 ), +1, 4 );
  imshow("Image1",image);
  // Draw a filled rectangle ( 5th argument is -ve)
  rectangle( image, Point( 115, 120 ), Point( 170, 150), Scalar( 100, 155, 25 ), -1, 8 );
  imshow("Image2",image);

  waitKey( 0 );
  return(0);
}
-------------

Drawing a Filled Polygon

void fillPoly(Mat& img, const Point** pts, const int* npts, int ncontours, const Scalar& color, int lineType=8, int shift=0, Point offset=Point() )
Parameters:
  • img – Image.
  • pts – Array of polygons where each polygon is represented as an array of points.
  • npts – Array of polygon vertex counters.
  • ncontours – Number of contours that bind the filled region.
  • color – Polygon color.
  • lineType – Type of the polygon boundaries. See the line() description.
  • shift – Number of fractional bits in the vertex coordinates.
  • offset – Optional offset of all points of the contours.
The function fillPoly fills an area bounded by several polygonal contours. The function can fill complex areas, for example, areas with holes, contours with self-intersections (some of their parts), and so forth.

Example 4: Drawing a Filled Polygon

-------------
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;

int main( )
{    
  // Create black empty images
  Mat image = Mat::zeros( 400, 400, CV_8UC3 );
  
  int w=400;
  // Draw a circle 
  /** Create some points */
  Point rook_points[1][20];
  rook_points[0][0] = Point( w/4.0, 7*w/8.0 );
  rook_points[0][1] = Point( 3*w/4.0, 7*w/8.0 );
  rook_points[0][2] = Point( 3*w/4.0, 13*w/16.0 );
  rook_points[0][3] = Point( 11*w/16.0, 13*w/16.0 );
  rook_points[0][4] = Point( 19*w/32.0, 3*w/8.0 );
  rook_points[0][5] = Point( 3*w/4.0, 3*w/8.0 );
  rook_points[0][6] = Point( 3*w/4.0, w/8.0 );
  rook_points[0][7] = Point( 26*w/40.0, w/8.0 );
  rook_points[0][8] = Point( 26*w/40.0, w/4.0 );
  rook_points[0][9] = Point( 22*w/40.0, w/4.0 );
  rook_points[0][10] = Point( 22*w/40.0, w/8.0 );
  rook_points[0][11] = Point( 18*w/40.0, w/8.0 );
  rook_points[0][12] = Point( 18*w/40.0, w/4.0 );
  rook_points[0][13] = Point( 14*w/40.0, w/4.0 );
  rook_points[0][14] = Point( 14*w/40.0, w/8.0 );
  rook_points[0][15] = Point( w/4.0, w/8.0 );
  rook_points[0][16] = Point( w/4.0, 3*w/8.0 );
  rook_points[0][17] = Point( 13*w/32.0, 3*w/8.0 );
  rook_points[0][18] = Point( 5*w/16.0, 13*w/16.0 );
  rook_points[0][19] = Point( w/4.0, 13*w/16.0) ;

  const Point* ppt[1] = { rook_points[0] };
  int npt[] = { 20 };

  fillPoly( image, ppt, npt, 1, Scalar( 255, 255, 255 ), 8 );
  imshow("Image",image);

  waitKey( 0 );
  return(0);
}
-------------

Putting Text in image

putText renders the specified text string in the image.

void putText(Mat& img, const string& text, Point org, int fontFace, double fontScale, Scalar color, int thickness=1, int lineType=8, bool bottomLeftOrigin=false )
Parameters:
  • img – Image.
  • text – Text string to be drawn.
  • org – Bottom-left corner of the text string in the image.
  • fontFace – Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN, FONT_HERSHEY_DUPLEX, FONT_HERSHEY_COMPLEX, FONT_HERSHEY_TRIPLEX, FONT_HERSHEY_COMPLEX_SMALL, FONT_HERSHEY_SCRIPT_SIMPLEX, or FONT_HERSHEY_SCRIPT_COMPLEX, where each of the font ID’s can be combined with FONT_HERSHEY_ITALIC to get the slanted letters.
  • fontScale – Font scale factor that is multiplied by the font-specific base size.
  • color – Text color.
  • thickness – Thickness of the lines used to draw a text.
  • lineType – Line type. See the line for details.
  • bottomLeftOrigin – When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.

Example 5: Putting Text in image

-------------
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;

int main( )
{ 
  // Create black empty images
  Mat image = Mat::zeros( 400, 400, CV_8UC3 );
  
  putText(image, "Hi all...", Point(50,100), FONT_HERSHEY_SIMPLEX, 1, Scalar(0,200,200), 4);
  imshow("Image",image);

  waitKey( 0 );
  return(0);
}
-------------

Source:
http://docs.opencv.org/modules/core/doc/drawing_functions.html?highlight=rectangle#void%20line%28Mat&%20img,%20Point%20pt1,%20Point%20pt2,%20const%20Scalar&%20color,%20int%20thickness,%20int%20lineType,%20int%20shift%29
  • ShahBaz

تفاوت haarcascades و haarcascades_cuda و hogcascades و lbpcascades

ShahBaz | پنجشنبه, ۲۱ مرداد ۱۳۹۵، ۰۳:۵۰ ب.ظ

LBP is faster (a few times faster) but less accurate. (10-20% less than Haar).

HOG is usually better for human detection, than Haar. I have only experience in this so I thought I'd give some input on that. However, the limitation of HOG is that the human must be within a "perfect" area on the screen. Too close, it won't detect the human. Too far, it won't detect the human.

I have had better luck with HOG than Haar. Haar gave me too many false positives.

I have been trying to use HAAR to detect human, and it turns out to give too many false positives. I think HAAR is only suitable for face or eye detection.

since your camera is in the sky, the human is pretty small in the image and got a whole body shape. HOG would be a better choice.

  • ShahBaz

Introduction to Computer Vision with the OpenCV Library on Linux

ShahBaz | يكشنبه, ۱۳ تیر ۱۳۹۵، ۰۶:۴۸ ب.ظ

1. Abstract

The purpose of this document is to help a reader to get started with Computer Vision library OpenCV on Linux system. OpencCV is a multi-platform library, but this article will be focused only on OpenCV using Linux operating system ( although, just the installation of the OpenCV library and video camera is platform-specific, all examples in this article should compile on any platform where OpenCV is properly installed such as Mac OS, MS Windows and etc.). Reader will be guided through a step-by-step guide on how to install and use some of the basic functions of OpenCV library such as displaying images, playing a video or using a video camera to process a video input stream.

Conventions used in this article:

  • $ - execution on the command line by a non-privileged user
  • # - execution on the command line by a superuser
  • the actual command to be executed on the command line or code of program to be compiled
  • OUTPUT: output produced on the command line by command execution
  • NOTE: general notes and additional information

2. Introduction

In simple words a Computer Vision is a scientific field which attempts to provide a sight to the machine. This scientific field has expanded rapidly in recent years. Among researchers this growth is because of many improvements of vision algorithms and among the computer vision hobbyists this is due to the cheaper hardware components and processing power. OpenCV library plays a great role in the Computer Vision field as it helps greatly to reduce cost and preparation time of computer vision research environment needed by university students, hobbyists and professionals. OpenCV also provides a simple to use functions to get the work done in a simple, effective and elegant manner. OpenCV was started by Intel, and later it was transformed to an open source project now available on SourceForge.net. OpenCV library has multi-platform availability, and it is partially written in C++ and C language. Despite the fact that this library is available on many Linux distributions from its relevant package repositories, in this article we will attempt to install and use OpenCV library compiled from a source code downloaded from SourceForge.net web site.


The reasons for compiling a source code may include:
  • new version 2.0.0 recently released and more features available
  • some bugs fixed which affected Linux OpenCV 1.0.0 versions ( such as cvGetCaptureProperty() etc. )
  • more support is available for OpenCV 2.0.0 version than for former 1.0.0 version

This article will start with installation of OpenCV on Debian 5.0 ( Lenny ). Later a reader will be guided through a number of examples on how to use OpenCV to display an image, play a video and use camera to capture the video input stream.

3. Installation

The following section will describe an installation process of OpenCV library by building a binaries from a source code available from SourceForge.net. The installation procedure demonstrated here was tested on Debian 5.0 ( Lenny ) and Ubuntu 9.10 ( Karmic Koala ). The actual installation procedure should be similar or exactly same for most Linux distributions apart of the first step where package dependencies are installed from relevant Debian and Ubuntu distribution repositories. On RPM linux system you sould consult your Red Hat package management ( RPM ) tool for alternatives to OpenCV prerequisites described in the next section.

3.1. Prerequisites

First, what needs to be done is the installation of required prerequisites required by OpenCV library. The list of dependencies can be slightly modified according to your needs:

  • libavformat-dev - development files for libavformat the ffmpeg file format library
  • libgtk2.0-dev - development files for the GTK+ graphical user interface library
  • pkg-config - manage compile and link flags for libraries
  • libswscale-dev - development files for libswscale the ffmpeg video scaling library
  • cmake - A cross-platform, open-source make system used for compilation of source code
  • bzip2 - high-quality block-sorting file compressor used to extract OpenCV source file

The following command will automatically fetch and install all required packages and its dependencies:

# apt-get install libavformat-dev libgtk2.0-dev pkg-config cmake libswscale-dev bzip2

3.2. Obtaining OpenCV source code

Current version of OpenCV library at the time of writing is a version 2.0.0. You can download an OpenCV source code by pointing your web browser to OpenCV-SourceForge.net or use the wget command to acquire a source code directly on the command line:

$ wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.0/OpenCV-2.0.0.tar.bz2

3.3. Extract OpenCV source code

Whether you used web browser or wget utility to download source code of OpenCV library you should end up with OpenCV-2.0.0.tar.bz2 tarball in your current working directory. The next step is to extract source files with the tar command. The following command will extract all files into OpenCV-2.0.0 directory:

$ tar xvjf OpenCV-2.0.0.tar.bz2

New OpenCV-2.0.0 directory ( approx. 67MB ) should be now available in your current working directory and will contain all necessary source files for a compilation.

3.4. Compilation and installation of OpenCV binaries

To compile OpenCV source code, we are going to use an open-source make system cmake. The following cmake configuration compile flags are going to be set:

  • CMAKE_BUILD_TYPE=RELEASE : cmake will bulid a release project
  • CMAKE_INSTALL_PREFIX=/usr/local : directory to be used as a installation destination
  • BUILD_PYTHON_SUPPORT : enable python support

NOTE: cmake utility by default does not provide a way to uninstall your project from a system. If you have a need to uninstall OpencCV from you system you should make appropriate changes before you proceed with compilation.

Navigate to OpenCV-2.0.0 directory containing a source code:

$ cd OpenCV-2.0.0/

Create and navigate to a new directory to be used by cmake. I this case, the directory name is same as project type, "release":

$ mkdir release; cd release

Use cmake to create a configuration files with configuration flags described above:

NOTE: CMAKE_INSTALL_PREFIX flag can be set to any desired installation path

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ..

After execution of the cmake command the installation summary will by displayed and will look similar to the one below.

OUTPUT:
-- General configuration for opencv 2.0.0 =====================================
--
-- Compiler:
-- C++ flags (Release): -Wall -pthread -ffunction-sections -O3 -DNDEBUG -fomit-frame-pointer -O3 -ffast-math -mmmx -DNDEBUG
-- C++ flags (Debug): -Wall -pthread -ffunction-sections -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release):
-- Linker flags (Debug):
--
-- GUI:
-- GTK+ 2.x: 1
-- GThread: 1
--
-- Image I/O:
-- JPEG: TRUE
-- PNG: TRUE
-- TIFF: FALSE
-- JASPER: FALSE
--
-- Video I/O:
-- DC1394 1.x: 0
-- DC1394 2.x: 0
-- FFMPEG: 1
-- codec: 1
-- format: 1
-- util: 1
-- swscale: 1
-- gentoo-style: 1
-- GStreamer: 0
-- UniCap:
-- V4L/V4L2: 1/1
-- Xine: 0
--
-- Interfaces:
-- Old Python: 0
-- Python: ON
-- Use IPP: NO
-- Build Documentation 0
--
-- Install path: /usr/local
--
-- &nbsp; cvconfig.h is in: /home/sandbox/OpenCV-2.0.0/release
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sandbox/OpenCV-2.0.0/release

When the execution of cmake command did not produce any errors, then we are ready to compile a source code.:

NOTE: There will be a number of warning messages shown on your terminal during a build process. These warning messages can be ignored, unless they do affect your preferred OpenCV environment settings!

$ make

If no errors were displayed on the terminal and the progress dialog reached [100%] during the build process, we are ready to install OpenCV libraries. The installation is optional as long as your environmental variable LD_LIBRARY_PATH is linked to an appropriate OpenCV built directory. If you wish to install OpenCV into /usr/local as set by cmake flags above, execute a following command:

# make install

Export correct path to LD_LIBRARY_PATH environment variable and use ldconfig to dynamically link to an OpenCV library:

$ export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
# ldconfig

If you do not wish to install OpenCV library you should just export a correct path to OpenCV library build directory to let your system know where the library is located. Suppose that your new release directory is located at ~/OpenCV-2.0.0/release then your export path will look like this:

$ export LD_LIBRARY_PATH=~/OpenCV-2.0.0/release/:$LD_LIBRARY_PATH
# ldconfig

This completes an installation procedure of OpenCV library. For additional information in regard to the OpenCV installation visit OpenCV install guide.

4. OpenCV examples

Without prolonging a discussion about what Computer vision is and how it is related to OpenCV we will now move right to some examples on how to write, compile and execute simple programs using OpenCV library. If you are interested in a more intense introduction to Computer Vision and OpenCV I recommend a book: "Learning OpenCV: Computer Vision with the OpenCV Library by Gary Bradski and Adrian Kaehler".

4.1. An Image conversion

Let's start with something really simple and that is 7 lines of code to convert image between following image types:

  • Windows bitmaps - BMP, DIB
  • JPEG files - JPEG, JPG, JPE
  • Portable Network Graphics - PNG
  • Portable image format - PBM, PGM, PPM
  • Sun rasters - SR, RAS
  • TIFF files - TIFF, TIF

The following program will accept two command line arguments, source image and destination image. Source image will be stored as an image type specified by destination image file extension. Save the following code in a file called image-conversion.c :

#include "highgui.h"

int main( int argc, char** argv ) {
IplImage* img = cvLoadImage( argv[1]);

cvSaveImage( argv[2] , img);
cvReleaseImage( &img );
return0;
}

Source code of our new program is ready and here comes the compilation part. Assuming that you have saved your first OpenCV program as image-conversion.c you can compile your program with the following command:

$ g++ `pkg-config opencv --cflags --libs` image-conversion.c -o image-conversion

After successful compilation a new executable binary file named image-conversion is created in your current working directory. Before we test this new program, we need some sample image:

$ wget -O image.png http://www.linuxconfig.org/templates/rhuk_milkyway/images/mw_joomla_logo.png

wget downloaded and saved an image image.png into your current directory, and we can now attempt to convert this image to any image type listed above. The following command will convert image type PNG to JPG. Assuming that program compilation did not produce any errors and your binary file is saved as image-conversion you can convert between two image types with following command:

$ ./image-conversion image.png image.jpg

To confirm that image was converted, a file command can be used to display a file type for a given file as an argument:

$ file image.*

OUTPUT:
image.jpg: JPEG image data, JFIF standard 1.01
image.png: PNG image, 270 x 105, 8-bit/color RGBA, non-interlaced

When you look at the compilation command once more you can observe that a pkg-config utility had been used to retrieve a location of an OpenCV library with the use of --cflags option as well as to get all dependencies using --libs option. Therefore, an alternative command to the one above without pkg-config utility can be constructed to look something like this:

g++ -I/usr/local/include/opencv -L/usr/local/lib \ 
-lcxcore -lcv -lhighgui -lcvaux -lml image-conversion.c -o image-conversion

However, in both cases the compilation command will create unwanted library dependencies:

$ ldd image-conversion | grep local

OUTPUT:
libcxcore.so.2.0 => /usr/local/lib/libcxcore.so.2.0 (0xb7ccc000)
libcv.so.2.0 => /usr/local/lib/libcv.so.2.0 (0xb7a7a000)
libhighgui.so.2.0 => /usr/local/lib/libhighgui.so.2.0 (0xb7a3f000)
libcvaux.so.2.0 => /usr/local/lib/libcvaux.so.2.0 (0xb793b000)
libml.so.2.0 => /usr/local/lib/libml.so.2.0 (0xb78d8000)

Our program is dependent on OpenCv's highgui.h library and therefore including -lcvaux -lml -lcxcore and -lcv dependencies into a compilation command is not necessary. A shortened version of compilation command will look like this:

$ g++ -I/usr/local/include/opencv -lhighgui image-conversion.c -o image-conversion

Consequently, a program library dependency had been reduced:

$ ldd image-conversion | grep local

OUTPUT:
libhighgui.so.2.0 => /usr/local/lib/libhighgui.so.2.0 (0xb7f61000)
libcxcore.so.2.0 => /usr/local/lib/libcxcore.so.2.0 (0xb7a75000)
libcv.so.2.0 => /usr/local/lib/libcv.so.2.0 (0xb7823000)

From now on, it is up to you how you compile following examples in this article. Keep in mind that the first compile command including pkg-config will be able to compile all examples. However, it may produce a binary with excessive dependencies.

4.2. Display an Image

At this point, we have been able to convert an image type and confirm its meta description by file command. It is time to display an image on the screen and visually confirm that it was converted correctly. The following example program will display an image on the screen:

#include "highgui.h"

int main( int argc, char** argv ) {
// cvLoadImage determines an image type and creates datastructure with appropriate size
IplImage* img = cvLoadImage( argv[1]);

// create a window. Window name is determined by a supplied argument
cvNamedWindow( argv[1], CV_WINDOW_AUTOSIZE );
// Display an image inside and window. Window name is determined by a supplied argument
cvShowImage( argv[1], img );
// wait indefinitely for keystroke
cvWaitKey(0);

// release pointer to an object
cvReleaseImage( &img );
// Destroy a window
cvDestroyWindow( argv[1] );
}

NOTE: Return to an image conversion section above, if you need help on how to compile this OpenCV program.

Execution of this display-image program with an image.jpg produced in preceding section will display this image on the screen:

$ display-image image.jpg

OUTPUT:

4.3. Gaussian smooth

You can also attempt to create a simple image transformation using the gaussian smooth method. Add a following line into your display-image code before a cvShowImage function call:
...

cvNamedWindow( argv[1], CV_WINDOW_AUTOSIZE );

cvSmooth( img, img, CV_GAUSSIAN, 9, 9 );

cvShowImage( argv[1], img );
...
and add as a first line to your program ' #include "cv.h" ' directive.

This will incorporate a gaussian smooth method centered on each pixel with 9 x 9 area into the output image. After compilation and execution a following output will be presented:
OUTPUT:

opencv gaussian smooth

4.4. Play video

This section includes a program code which will create a simple video player using OpenCV library. Sample video, tree.avi can be found in your OpenCV-2.0.0 directory where you have extracted its source files ( OpenCV-2.0.0/samples/c/tree.avi ) :

#include "cv.h"
#include "highgui.h"

// initialize global variables
int g_slider_position = 0; // trackbar position
CvCapture* g_capture = NULL; // structure to create a video input

// routine to be called when user moves a trackbar slider
void onTrackbarSlide(int pos) {
cvSetCaptureProperty(
g_capture,
CV_CAP_PROP_POS_FRAMES,

pos
);
}

int main( int argc, char** argv ) {

// create a window with appropriate size. Windows name is determined by file name
// supplied as an argument
cvNamedWindow( argv[1], CV_WINDOW_AUTOSIZE );
// open video
g_capture = cvCreateFileCapture( argv[1] );
// set read position in units of frames and retrieve total number of frames
int frames = (int) cvGetCaptureProperty(

g_capture,
CV_CAP_PROP_FRAME_COUNT
);


// do not create treackbar if video does not include an information
// about number of frames
if( frames!=0 ) {

cvCreateTrackbar(
"Position",
argv[1],
&g_slider_position,
frames,

onTrackbarSlide
);
}

// display video frame by frame
IplImage* frame;
while(1) {

frame = cvQueryFrame( g_capture );
if( !frame ) break;
cvShowImage( argv[1], frame );
// set trackbar to a current frame position
cvSetTrackbarPos("Position", argv[1], g_slider_position);

g_slider_position++;

char c = cvWaitKey(33);
// quit if ESC is pressed
if( c == 27 ) break;

}
// free memory
cvReleaseCapture( &g_capture );
cvDestroyWindow( argv[1] );
return(0);
}

NOTE: Return to an image conversion section above, if you need help on how to compile this OpenCV program.

Execute your new OpenCV program and as an argument supply a video file:

 $ ./video-player ~/OpenCV-2.0.0/samples/c/tree.avi

OUTPUT:
example opencv video programm

4.5. Input from a video camera

The aim of this section is to provide some simple tips on how to configure a camera on a linux system and how to confirm that your video camera is recognized by your system correctly. When your camera is ready, you will be presented with a simple program which is capable to display a video using a video camera as an input.

For this article I have used a Logitech, Inc. QuickCam Pro 9000 camera. Installation of this camera on Debian 5.0 or Ubuntu 9.10 ( Karmic Koala ) system was simple Plug & Play procedure. Here are some hints on how to confirm that your camera had been recognized by your system:

NOTE:
your output will be different !

$ lsusb

OUTPUT:
Bus 002 Device 003: ID 046d:0990 Logitech, Inc. QuickCam Pro 9000
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 045e:00d1 Microsoft Corp. Optical Mouse with Tilt Wheel
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


lsusb command reveals a camera type plugged into your system. Output of lsusb command does not necessary means that your camera is now ready to use. Let's see if some modules are associated with video:

$ lsmod | grep video

OUTPUT:
uvcvideo 45800 0
compat_ioctl32 1312 1 uvcvideo
videodev 27520 1 uvcvideo
v4l1_compat 12260 2 uvcvideo,videodev
usbcore 118192 7 snd_usb_audio,snd_usb_lib,uvcvideo,usbhid,ehci_hcd,ohci_hcd


This looks very promising. My camera is using uvcvideo module. If you do not see any ouptut or you see only output not related to your camera device you may need to recompile your kernel or install an appropriate module.

Now we need to find a device file corresponding with your camera. To do that we use xawtv utility:

NOTE: if xawtv command is not avaialable you need to install xawtv package.

$ xawtv -hwscan

OUTPUT:
This is xawtv-3.95.dfsg.1, running on Linux/i686 (2.6.26-2-686)
looking for available devices
port 65-96
type : Xvideo, image scaler
name : NV Video Blitter

/dev/video0: OK [ -device /dev/video0 ]
type : v4l2
name : UVC Camera (046d:0990)
flags: capture


The device file assciated with my camera is /dev/video0 . You may also see an error on your terminal saying: open /dev/video0: Permission denied. To fix this problem you need to make your self a part of a group "video". Now test your camera with a following command:

$ xawtv -c /dev/video0

If you had some issues in some of the previous steps, here are some links, which may assist you to troubleshoot your problem:

To use a camera with the OpenCV library is simple as writing a program to play video. Copy a previously created source code of your video player program and change line:

CvCapture* capture = cvCreatefileCapture(argv[1]);
to:
CvCapture* capture = cvCreateCameraCapture(0);

So the whole code will look similar to the one below:

#include "highgui.h"
int main( int argc, char** argv ) {
cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE );

CvCapture* capture = cvCreateCameraCapture(0) ;
IplImage* frame;


while(1) {
frame = cvQueryFrame( capture );
if( !frame ) break;

cvShowImage( "Example2", frame );
char c = cvWaitKey(33);
if( c == 27 ) break;

}
cvReleaseCapture( &capture );
cvDestroyWindow( "Example2" );
}

Notice that a function cvCreateCameraCapture() did not take any specific device file or argument. In this case OpenCV will start using the first available camera in your system. Compile and execute this program and if everything up to this point went well you should see yourself on your screen.

NOTE: Return to an image conversion section above, if you need help on how to compile this OpenCV program.

4.6. Write avi file from a camera

The last example will attempt to read an input from a camera and write it to a file. In the meantime, the program will also display a window with a camera input video stream. The Video input is saved to a file supplied as an argument on the command line. The codec used is specified by FOURCC ( Four Character Code ) MJPG which in this case is Motion JPEG. This sample program is very basic and there is a plenty of room for improvement:

#include <cv.h>
#include <highgui.h>
main( int argc, char* argv[] ) {

CvCapture* capture = NULL;
capture = cvCreateCameraCapture( 0 );

IplImage *frames = cvQueryFrame(capture);

// get a frame size to be used by writer structure
CvSize size = cvSize (
(int)cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH),

(int)cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT)
);

// declare writer structure
// use FOURCC ( Four Character Code ) MJPG, the motion jpeg codec
// output file is specified by first argument
CvVideoWriter *writer = cvCreateVideoWriter(
argv[1],

CV_FOURCC('M','J','P','G'),
30, // set fps
size

);
//Create a new window
cvNamedWindow( "Recording ...press ESC to stop !", CV_WINDOW_AUTOSIZE );
// show capture in the window and record to a file
// record until user hits ESC key
while(1) {

frames = cvQueryFrame( capture );
if( !frames ) break;
cvShowImage( "Recording ...press ESC to stop !", frames );
cvWriteFrame( writer, frames );

char c = cvWaitKey(33);
if( c == 27 ) break;
}
cvReleaseVideoWriter( &writer );
cvReleaseCapture ( &capture );
cvDestroyWindow ( "Recording ...press ESC to stop !");

return0;

}

Assuming that you saved and compiled this programm as "save-camera-input" you can strat recording a video to a video-file.avi with this command:
NOTE: Return to an image conversion section above, if you need help on how to compile this OpenCV program.

$ ./save-camera-input video-file.avi

5. Conclusion

This article should give a you a good start to OpenCV library from an installation perspective. Examples presented do not have much to do with Computer Vision itself, but rather they provide a good testing ground for your OpenCV installation. Even from these simple OpenCV examples it is also clear that OpenCV is a highly civilized library since with just couple lines of OpenCV code you can achieve great results. Your comment on this article is highly appreciated as it may have a great impact on article quality. There is more comming about OpenCV, so stay tuned by subcribing to linuxconfig.org RSS feed ( top left corner ).

  • ShahBaz

بهترین توزیع لینوکس برای سخت افزارهای قدیمی

ShahBaz | جمعه, ۲۸ خرداد ۱۳۹۵، ۱۰:۴۸ ب.ظ

سیستم عامل کروم، بهترین سیستم عامل ابری

شاید به نظر برسد که سیستم عامل کروم (Chrome OS) توزیع مبتنی بر لینوکس دلخواه شما نباشد، چرا که این سیستم عامل در واقع بیشتر مبتنی بر مرورگر است و برای فعالیت های آنلاین مناسب است؛ با این وجود، از آن جا که کروم، مبتنی بر لینوکس است و سورس کد آن قابل کامپایل شدن برای هر شخصی می باشد، سیستم عامل جذابی به شمار می رود.

سیستم عامل کروم، همیشه به روز است و برای هر شخصی که فعالیت های مرتبط با وب داشته باشد، مناسب است. کروم، امروزه در عرصه تجاری و بازار مورد توجه قرار گرفته است و بر محبوبیت دنیای لینوکس افزوده است.

 

بهترین سیستم عامل برای لپ تاپ، اوبونتو میت

اغلب لپ تاپ های موجود در بازار، از سخت افزارهای با کیفیتی برخوردار نیستند؛ بنابراین اگر از محیط دسکتاپ سنگینی استفاده کنید، شارژ باتری و همچنین منابع سیستمی شما بیشتر در اختیار سیستم عامل خواهند بود و قادر به پاسخگویی به نیاز سایر برنامه ها نیستند.

اوبونتو میت (Ubuntu Mate) سیستم عاملی است که بر این مشکل غلبه کرده است. این سیستم عامل علاوه بر سبک بودن، با در اختیار داشتن قابلیت های بالا، تجربه دلپذیری را در اختیار کاربر قرار می دهد. از آن جایی که اوبونتو میت به صورت سبک طراحی شده است، اکثر منابع سیستمی در اختیار نرم افزارهای دیگر جهت انجام امور سنگین قرار می گیرند. بنابراین حتی اگر لپ تاپ شما پایین ترین درجه سخت افزاری را دارد، اوبونتو میت می تواند کارایی بالایی داشته باشد.

 

بهترین توزیع برای سخت افزارهای قدیمی، لوبونتو

اگر لپ تاپ یا کامپیوتری دارید که به شدت قدیمی و فرسوده شده است، با استفاده از لوبونتو (Lubuntu) عمر دوباره ای پیدا خواهد کرد. لوبنتو از محیط دسکتاپی LXDE استفاده می کند، امّا این پروژه با Razor Qt ادغام شده است تا LXQtرا ایجاد کنند. با اینکه آخرین ورژن از لوبونتو (ورژن 15.04)  همچنان از LXDE بهره می برد، انتظار می رود در ورژن های آینده، از LXQt استفاده شود. در هر صورت، لوبونتو یک سیستم عامل کارا برای سخت افزارهای قدیمی محسوب می شود.

 

بهترین توزیع برای اینترنت اشیاء، Snappy Ubuntu Core

اگر به دنبال اینترنت اشیاء (Internet of Things) یا IoT هستید، بهتر است بدانید که Snappy Ubuntu Core، بهترین سیستم عامل مبتنی بر لینوکس در این زمینه است. این سیستم عامل، پتانسیل بالایی در تبدیل هر چیزی به یک دستگاه هوشمند را دارد. از ویژگی های جالب این سیستم عامل، مدیریت آپدیت های نرم افزاری و همچنین ایجاد امنیت مضاعف است.

 

بهترین توزیع برای دسکتاپ، لینوکس مینت سینامون

لینوکس مینت سینامون (Linux Mint Cinnamon) بهترین سیستم عامل برای لپ تاپ های قوی و دسکتاپ محسوب می شود. این توزیع را می توان مشابه سیستم عامل مک (Mac OS X) در نظر گرفت. حقیقتش را بخواهید، شخصاً برای مدت زیادی از طرفداران لینوکس مینت نبودم به خاطر عدم پایداری سینامون. امّا به محض اینکه توسعه دهندگان تصمیم گرفتند که از LTS به عنوان پایه اصلی این سیستم عامل استفاده کنند، این توزیع به طرز خارق العاده ای به ثبات و پایداری رسید. از آن جایی که توسعه دهندگان لینوکس مینت سینامون، دیگر نیازی به همگام شدن با اوبونتو ندارند، تمام سعی خود را بر آن داشته اند که زمان خود را فقط صرف بهبود قابلیت های سینامون کنند.

 

بهترین توزیع برای بازی، استیم

بازی یکی از نقاط ضعف دنیای لینوکس محسوب می شود. بسیاری از کاربران (از جمله خود بنده) ترجیح می دهند که سیستم عامل لینوکس را در کنار ویندوز نصب کنند تا فقط بتوانند بازی های مورد علاقه خود را روی ویندوز اجرا کنند. کمپانی Valve Software سعی بر آن دارد که این مشکل را رفع کند. Valve، یک توزیع کننده بازی است که به کاربر اجازه می دهد بازی های خود را بر روی پلتفرم های متفاوت اجرا کند. این کمپانی به تازگی سیستم عامل مخصوص به خود را تحت عنوان استیم (Steam OS) ایجاد کرده است که یک سیستم عامل مبتنی بر لینوکس و پلتفرمی برای بازی محسوب می شود. استیم در اواخر 2015 روانه بازار گردید.

  • ShahBaz

دانلود کتابهای مرتبط با OpenCv

ShahBaz | جمعه, ۲۸ خرداد ۱۳۹۵، ۰۵:۱۸ ب.ظ

دانلود کتاب پردازش تصویر با اپن سی وی

http://curomediares.com/link/opencv-by-example-free-download-ebook-pdf

Book Details

Publisher: Packt Publishing
By: Prateek JoshiDavid Millan EscrivaVinicius Godoy
ISBN: 978-1-78528-094-8
Year: 2016
Pages: 296
Language: English
File size: 15.8 MB
File format: PDF

eBook

Download: OpenCV By Example


عنوان کتاب: Learning OpenCV

نویسنده: Gary Bradski and Adrian Kaehler

ناشر: O’Reilly Media

سال انتشار: ۲۰۰۸

زبان: انگلیسی

تعداد صفحات فایل پی دی اف: ۵۷۷ صفحه (سیاه و سفید)

حجم فایل: ۱۳٫۴ مگابایت

توضیح: این کتاب آموزش OpenCV از انتشارات اوریلی دارای یک سی دی همراه می‌باشد که می‌توانید آن را نیز دانلود نمایید.


 

کتاب: جستارهای نوین در اتوماسیون و رباتیک


محتویات سی دی همراه کتاب (حجم: ۱۹٫۹ مگابایت) :

download


http://bookyar.net/?paperurl=opencv&I1.x=0&I1.y=0&I1=submit


http://curomediares.com/tag/opencv


http://farinsoft.ir/blog/component/tags/tag/377-opencv


https://km20.eu/learning-opencv-computer-vision-in-c-with-the-opencv-library-early-2016-release-o-reilly-2016-t12170807.html


 

OpenCV By Example

Learning
Prateek Joshi, David Millán Escrivá, Vinícius Godoy

Enhance your understanding of Computer Vision and image processing by developing real-world projects in OpenCV 3
cmake+qt+mingwopencv

qt

 

  • ShahBaz

راه اندازی اولیه EMGU CV

ShahBaz | جمعه, ۲۸ خرداد ۱۳۹۵، ۰۴:۵۸ ب.ظ

راه اندازی اولیه EMGU CV

EMGU CV به عنوان واسطی برای زبان #C به منظور استفاده از توابع کتابخانه opencv استفاده میشود .

کتابخانه open cv قابلیت پیکر بندی بر روی بسترهای نرم افزاری که زبان C , ++C را ساپورت میکنند دارد ولی برای برنامه هایی که به زبان سی شارپ نوشته می شود شما باید کتابخانه EMGU CV را بر روی نرم افزار ویژوال استودیو پیکربندی کنید تا به راحتی توانایی استفاده از توابع پردازش تصویر را پیدا کنید . EMGU CV را دانلود کرده و اکسترکت کنید . برای نصب این کتابخانه بر روی ویژوال استودیو ۲۰۱۰ مراحل زیر را طی کنید : ابتدا پروژه مورد نظر خودتان را در سی شارپ ایجاد کنید : ما در اینجا از پروژه windows form application استفاده می کنیم ، بعد از ایجاد پروژه در پنجره Solution Explorer بر روی فایل پروژه کلیک راست کرده و Add Refrence را بزنید . مطابق شکل بر روی تب Browse کلیک کرده و مسیری که پوشه EMGU قرار داره را پیدا کرده و از پوشه های لیست شده در آن پوشه bin را باز کنید و سه فایل dll زیر را انتخاب کرده ( برای انتخاب هر سه کلید کنترل را فشار دهید و روی هر کدام کلیک کنید)

 

  • Emgu.CV.dll
    • Emgu.CV.UI.dll
    • Emgu.Util.dll

 

و دکمه OK را بزنید . حالا برای استفاده از آنها در پروژه این دستورات را در محیط وارد کنید :

using Emgu.CV;
using Emgu.Util;
using Emgu.CV.Structure;

بر روی در پنجره solution Expelorer کلیک را ست کرده و Add Exiting Item را بزنید … باز هم پوشه bin را باز کنید و دو فایل زیر را انتخاب کرده و OK کنید :پروژه

 

  • opencv_core220.dll
    • opencv_imgproc220.dll

البته در ورژن جدید ارقام پسوند ۲۳۱ هستند . حالا شما میتونید این دو فایل را در پنجره solution ببنید آنها را بگیرید و زیر form1.cs در همین پنجره بندازید (Drag & Drop) حالا باید روی تک تک آنها کلیک کرده و در پنجره Properties تنظیمات زیر را اعمال کنید : قسمت copy to output directory به صورت پیش فرض بر روی don’t copy تنظیم شده …شما باید این قسمت را به حالت copy always ببرید حالا دیگه به راحتی میتونید از این کتابخانه برا ی پردازش تصویر استفاده کنید … البته بستگی به استفاده از توابع مورد نظرتون باید مثل همین مراحل فایل های dll دیگه را هم اضافه کنید اولین پروژه را با هم دنیال میکنیم : یک کنترل Button و یک picture Box به پنجره form اضافه کنید و کد زیر را برای رویداد کلیک کردن وارد کنید : ( باید قبل از این کار دوبار بر روی Button کلیک کنید تا فایل با پسوند cs باز بشه )

 

private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog Openfile = new OpenFileDialog();
if (Openfile.ShowDialog() == DialogResult.OK)
{
Image My_Image = new Image(Openfile.FileName);
pictureBox1.Image = My_Image.ToBitmap();
}

}

حالا میتونید پروژه را کامپایل کرده و نتیجه را ببنید : بعد از ران کردن میبینید که یک پنجره دیالوگ باز شده و شما میتونید تصویر مورد نظر خودتون را وارد کنید و آن را در picture box پنجره form مشاهده کنید .بعدش اکستراکت کنید و طبق اموزش  در بالا عمل کنید در همه نسخه ها ویژوال به همین صورته و واسه هر پروژه باید این کارو انجام بدید حتی میتونید در پروژه های دیگر .net هم اینکارو انجام بدیددر ضمن  واسه کار با emgu هیچ نیازی به نصب opencv ندارید چون emgu از همون opencv هست ولی واسه .net ایجاد شدهدوتا نکته خیلی مهم که اکثرا واسه راه اندازیemgu  به مشکل برمیخورن از جمله خود من اوایل زیاد برام پیش میومدیک اینکه برا فایلا dll که تو قسمت emgu/binx64 و برا ۳۲ بیتی emgu/bin/x86 را داخل فولدر system32 جایی که ویندوز را نصب کردید کپی کنیددوم اینکه واسه بچه هایی که از نسخه ۶۴ بیتی استفاده میکنند اگه تو اجرا باز به مشکل بر خوردید حالت debug را روی x64 قرار بدید

  • ShahBaz