OpenCV Constants.CaptureProperty

Hi, I am using OpenCV Java and have some problems.

I open a video file and try to get a property like FPS. Other:

  • CV_CAP_PROP_POS_MSEC
  • CV_CAP_PROP_FRAME_COUNT

So, first I opened the video as follows:

VideoCapture vC = new VideoCapture(url2);

and then I have a problem with the function

vC.get(int i)

in opencv c ++ it looks like

vC.get(CV_CAP_PROP_FPS);

In Java, where do I find these constants? I did not find them in HighGui. Just what I find is another OpenCV library where these constants are http://siggiorn.com/wp-content/uploads/libraries/opencv-java/docs/sj/opencv/Constants.CaptureProperty.html . But where do I find them in OpenCV Java. Anyway, how should I use the vC.get () function? Maybe some kind of working example?

+2
3

.

, ++ .

Edit:

. /highgui/include/opencv 2/highgui.hpp. :

   CAP_PROP_POS_MSEC       =0,
   CAP_PROP_POS_FRAMES     =1,
   CAP_PROP_POS_AVI_RATIO  =2,
   CAP_PROP_FRAME_WIDTH    =3,
   CAP_PROP_FRAME_HEIGHT   =4,
   CAP_PROP_FPS            =5,
   CAP_PROP_FOURCC         =6,
   CAP_PROP_FRAME_COUNT    =7,
   CAP_PROP_FORMAT         =8,
   CAP_PROP_MODE           =9,
   CAP_PROP_BRIGHTNESS    =10,
   CAP_PROP_CONTRAST      =11,
   CAP_PROP_SATURATION    =12,
   CAP_PROP_HUE           =13,
   CAP_PROP_GAIN          =14,
   CAP_PROP_EXPOSURE      =15,
   CAP_PROP_CONVERT_RGB   =16,
   CAP_PROP_WHITE_BALANCE_BLUE_U =17,
   CAP_PROP_RECTIFICATION =18,
   CAP_PROP_MONOCROME     =19,
   CAP_PROP_SHARPNESS     =20,
   CAP_PROP_AUTO_EXPOSURE =21, // DC1394: exposure control done by camera, user can adjust refernce level using this feature
   CAP_PROP_GAMMA         =22,
   CAP_PROP_TEMPERATURE   =23,
   CAP_PROP_TRIGGER       =24,
   CAP_PROP_TRIGGER_DELAY =25,
   CAP_PROP_WHITE_BALANCE_RED_V =26,
   CAP_PROP_ZOOM          =27,
   CAP_PROP_FOCUS         =28,
   CAP_PROP_GUID          =29,
   CAP_PROP_ISO_SPEED     =30,
   CAP_PROP_BACKLIGHT     =32,
   CAP_PROP_PAN           =33,
   CAP_PROP_TILT          =34,
   CAP_PROP_ROLL          =35,
   CAP_PROP_IRIS          =36,
   CAP_PROP_SETTINGS      =37
+7

import org.opencv.videoio.Videoio;

vc.open(FD.class.getResource("1.avi").getPath());
double totalFrameNumber = vc.get(Videoio.CAP_PROP_FRAME_COUNT);  
System.out.println("\n"+totalFrameNumber);
+2

It seems that the error is resolved . Now you can use it as:

VideoCapture vC = new VideoCapture(...);
nbFrames = vC.get(Videoio.CAP_PROP_FRAME_COUNT);
0
source

Source: https://habr.com/ru/post/1527511/


All Articles