Ask Your Question

Opencv java vs C++ in video capture

asked 2016-06-05 16:55:38 -0500

Indira gravatar image

updated 2016-06-05 16:56:11 -0500

I'm creating a project that needs to capture live camera video feeds continuously all the time and does processing on each frame. Processing involves locating a particular object of interest when it is moving. i have done this project using Opencv java wrappers videocapture,BackgroundSubtracterMOG etc. I was successful in doing this and happy about it.

I have tested my application using 4 threads and each thread reading a different video and processing frames. my machine configuration is 4.00 GB RAM and 64 bit OS and Intel Core i5 . The results were not bad. i have not tested it yet on real time camera feeds though. In future we may have to increase number of threads based on no of cameras we use.

Recently i was questioned about speed overhead of reading videos using java compared C++.
i know there would be slight speed overhead while using Java wrappers compared to C++ calls.

1) but I want to understand how big is the impact and need a suggestion if i really need to switch to c++ esp for continuous capture of video frames as explained above and re-implement the same code in C++? . I'm completely new to c++ and i have to learn c++ and re-implement it again.

2) if i have to switch to C++, then why the video capture wrappers were provided in java ?.

3) And also I observed in java version that when i reduce the frame size of video captured the speed got improved significantly. so what is it really that impacts the performance in video capture?

This is very important for me right now. It would be very helpful if i could get answer ASAP . Thanks in Advance.

edit retag flag offensive close merge delete



imho, unless you're doing something obviously stupid (like a lot of get() put() calls) you should not worry about the java wrappers being slower than c++

3) - sure, less pixels -> faster. but again, unrelated to java vs c++

berak gravatar imageberak ( 2016-06-06 00:19:38 -0500 )edit

I have this problem too. When i grab image from camera in 1280x720 size by c++, i take about 25fps. But by java, i can take only 9fps. This is very important for me to resolve rightly and quickly, low speed in java. thanks a lot. and I am waiting for a solution.

A.Nemati gravatar imageA.Nemati ( 2016-11-22 03:00:50 -0500 )edit

We moved to C++ due to different reasons. not using Java anymore. please see the above answer given by berak. I'm not from support just user here..

Indira gravatar imageIndira ( 2016-11-28 15:26:37 -0500 )edit

2 answers

Sort by » oldest newest most voted

answered 2016-12-01 04:58:25 -0500

LBerger gravatar image

updated 2016-12-01 05:01:45 -0500

I have got an answer (from opencv team) to your comments @A.Nemati:

full text is here

By downloading, copying, installing or using the software you agree to this license.

If you do not agree to this license, do not download, install, copy or use the software.

License Agreement

For Open Source Computer Vision Library

(3-clause BSD License)
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the names of the copyright holders nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission.

This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall copyright holders or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of
the use of this software, even if advised of the possibility of such damage.
edit flag offensive delete link more

answered 2016-11-27 01:11:40 -0500

A.Nemati gravatar image

updated 2016-11-27 01:17:34 -0500

Any answer ?????? what is it ? What kind of support is this ?

I tried to contact you @Indira but I can not find any contact information regarding this similar issue from your profile, what did you do for solving this problem buddy ???

edit flag offensive delete link more



Support ? it's a forum where only some users help other users for free

LBerger gravatar imageLBerger ( 2016-11-27 03:03:10 -0500 )edit

Thus, what is "SUPPORT -> ASK A QUESTION" link in home page ? This link means, opencv's support department, will respond to questions.

A.Nemati gravatar imageA.Nemati ( 2016-11-29 02:24:47 -0500 )edit

@A.Nemati, as a moderator to this forum, I feel kind of obliged to answer you. All I can say is that your behaviour is not what will people push to help you. There are some simple reasons for this

  1. This is a user guided forum, managed and ran by volunteers working together with Intel developers to give people a change at solving their solutions. The whole concept of a open-source framework is that it is developed and managed by users.
  2. That being said, people tend to answer questions they can actually answer, and thus the questioneer should either, remark that noone is answering and provide more information where possible (instead of hijacking an older topic), even if that requires opening up a new topic.
StevenPuttemans gravatar imageStevenPuttemans ( 2016-12-01 08:31:21 -0500 )edit

To continue ...

  1. Your attitude is just rude ... you have contributed zero to this framework and you expect people to jump for you right away. In my experience, that is not how it works. Open up a question, show what you tried, where the error occured, your setup, your conditions, ...
  2. Yes the link states support, but for again a free to use open source package, can you really expect people to give you an answer immediatly?

So in the future, be patient, or your topics and responses in this manner will simply get deleted/closed down.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-12-01 08:33:42 -0500 )edit

Question Tools



Asked: 2016-06-05 16:55:38 -0500

Seen: 851 times

Last updated: Dec 01 '16