What is minimum disparity and number of disparities in stereo matching
↧
What is number of disparities in stereo matching?
↧
Suppress, hide or disable the error/warning messages
I was wondering if there was a way to suppress, hide or disable the error or warning messages outputted to the screen?
I think they come from FFMpeg and they either show up as follows:
CASE 1:
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
or CASE 2: ... [h264 @ 0x29e5a40] co located POCs unavailable
[h264 @ 0x2a6c3c0] co located POCs unavailable
[h264 @ 0x29d7b80] reference picture missing during reorder
[h264 @ 0x29d7b80] Missing reference picture, default is 65656
[h264 @ 0x298da80] mmco: unref short failure
[h264 @ 0x298da80] number of reference frames (0+6) exceeds max (5; probably corrupt input), discarding one
[h264 @ 0x29dc700] reference picture missing during reorder
[h264 @ 0x29dc700] Missing reference picture, default is 65672
[h264 @ 0x2a27180] mmco: unref short failure
[h264 @ 0x2af7680] co located POCs unavailable
[h264 @ 0x29e5a40] mmco: unref short failure
[h264 @ 0x29e5a40] number of reference frames (0+6) exceeds max (5; probably corrupt input), discarding one
[h264 @ 0x2af9040] mmco: unref short failure
To my understanding CASE 1, is a known issue, as it is looking for a PES header. There are only a few of these messages until it finds the header. I do not understand CASE 2, I do not know what is happening, but it seems to read the image @ frame. There are many many of these messages which outputs to the console window and adds minutes to the processing time.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
[mpeg2video @ 0x3430c00] Invalid frame dimensions 0x0.
or CASE 2: ... [h264 @ 0x29e5a40] co located POCs unavailable
[h264 @ 0x2a6c3c0] co located POCs unavailable
[h264 @ 0x29d7b80] reference picture missing during reorder
[h264 @ 0x29d7b80] Missing reference picture, default is 65656
[h264 @ 0x298da80] mmco: unref short failure
[h264 @ 0x298da80] number of reference frames (0+6) exceeds max (5; probably corrupt input), discarding one
[h264 @ 0x29dc700] reference picture missing during reorder
[h264 @ 0x29dc700] Missing reference picture, default is 65672
[h264 @ 0x2a27180] mmco: unref short failure
[h264 @ 0x2af7680] co located POCs unavailable
[h264 @ 0x29e5a40] mmco: unref short failure
[h264 @ 0x29e5a40] number of reference frames (0+6) exceeds max (5; probably corrupt input), discarding one
[h264 @ 0x2af9040] mmco: unref short failure
To my understanding CASE 1, is a known issue, as it is looking for a PES header. There are only a few of these messages until it finds the header. I do not understand CASE 2, I do not know what is happening, but it seems to read the image @ frame. There are many many of these messages which outputs to the console window and adds minutes to the processing time.
↧
↧
Error using cmake on Windows with Visual Studio 2017 and OpenCV 3.4.3
Hi,
I am following this page from [OpenCV Docs](C:\OpenCV34\opencv\build\x64\vc15) to use cmake with OpenCV.
This is my file structure,
- displayopencv\
-- CMakeLists.txt
-- DisplayImage.cpp
CMakeLists.txt contains,
cmake_minimum_required(VERSION 2.8)
set(OpenCV_DIR C:/OpenCV34/opencv/build)
project( DisplayImage )
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )
I run `cmake .` in this directory inside command prompt and get the following error,
-- Selecting Windows SDK version 10.0.16299.0 to target Windows 10.0.17134.
-- OpenCV ARCH: x86
-- OpenCV RUNTIME: vc14
-- OpenCV STATIC: OFF
CMake Warning at C:/OpenCV34/opencv/build/OpenCVConfig.cmake:156 (message):
Found OpenCV Windows Pack but it has no binaries compatible with your
configuration.
You should manually point CMake variable OpenCV_DIR to your build of OpenCV
library.
Call Stack (most recent call first):
CMakeLists.txt:4 (find_package)
CMake Error at CMakeLists.txt:4 (find_package):
Found package configuration file:
C:/OpenCV34/opencv/build/OpenCVConfig.cmake
but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND.
-- Configuring incomplete, errors occurred!
See also "E:/Code/cmake/displayopencv/CMakeFiles/CMakeOutput.log".
I cannot figure out what's wrong, it selected the OpenCV arch incorrect too. I have 64-bit OpenCV installed at that location,
C:\OpenCV34\opencv\build>dir
Volume in drive C has no label.
Volume Serial Number is E8D4-7C0B
Directory of C:\OpenCV34\opencv\build
01-09-2018 11:47 .
01-09-2018 11:47 ..
01-09-2018 11:49 bin
01-09-2018 11:47 etc
01-09-2018 11:47 include
01-09-2018 11:47 java
11-04-2018 07:48 2,275 LICENSE
29-08-2018 16:05 433 OpenCVConfig-version.cmake
29-08-2018 16:05 5,728 OpenCVConfig.cmake
01-09-2018 11:47 python
01-09-2018 11:47 x64
3 File(s) 8,436 bytes
8 Dir(s) 93,118,218,240 bytes free
C:\OpenCV34\opencv\build>dir x64
Volume in drive C has no label.
Volume Serial Number is E8D4-7C0B
Directory of C:\OpenCV34\opencv\build\x64
01-09-2018 11:47 .
01-09-2018 11:47 ..
01-09-2018 11:47 vc14
01-09-2018 11:47 vc15
0 File(s) 0 bytes
4 Dir(s) 93,118,218,240 bytes free
How do I fix this issue and use cmake with OpenCV on Windows 10 computer?
↧
what should i do, to make videoWriter could record video per 30second
hi,guy, i want to record a video per 30 seconds, but it's fail, only record about 14-16s video(about half time)
how can i change my code,
this is my code:
if liveWriter.isOpened() is False: # record live video
live_path = live_path + os.sep + str(recordTime).replace("-", "_").replace(" ", "_").replace(":", "_")\
+ '.avi'
liveWriter.open(live_path, fourcc, int(cap.get(cv2.CAP_PROP_FPS)),
(int(frame.shape[1]), int(frame.shape[0])))
livePathList.append(live_path)
liveWriter.write(frame)
if recordTime > live_range_end: # if now time is over the range_end time, start a new video
live_range_start, live_range_end = mod.get_time_range(datetime.datetime.now(), interval_hour=0,
interval_minute=0, interval_second=30) # get the time range
liveWriter.release()
by the way, i have 3 videoWriter in this .py file
↧
How to crop only the form on this image? opencv 3.2
Hi there. I'm trying to crop just the form from this image without the content outside of the box.
[C:\fakepath\img.jpg](/upfiles/15367105594836024.jpg)
So far I've been able to get just the just content.
[C:\fakepath\img2.PNG](/upfiles/15367111666029404.png)
Can someone please show me how to do this in code? OpenCv has been a challenge for me. I really need some hand holding. Thanks in advanced.
@ak1 Thanks for the answer. It worked the image i provided. But I tried the with a similar image, it only gives me a brown box.
↧
↧
Concept Question: Use OpenCV directly on Raspberry Pi or on stronger PC
Hi,
My question is more conceptual in nature and I hope someone can shed some light on the subject.
Would it be better to record and analyze video for facial recognition and identification directly on a raspberry pi or would it be better to only capture the video with the pi and send it to a stronger pc for the processing and analyzing part?
Thank you in advance!
Kind Regards
↧
memory leak leaded by videocapture release method
I have a scenario that one TX2 may connect to multi rtsp camera,and each camera only need one picture every two minute.I want to save cpu utilization to support more camera in one TX2 device。I thinking I can open one camera when I need it,than I close it until next schedule time。But I get a memory leak .Sample code like this.
int main(int argc, char** argv) {
string ss="rtspsrc location=\"rtsp://admin:admin11@30.115.26.138:554/cam/realmonitor?channel=1&subtype=1\" latency=0 ! decodebin ! videoconvert ! appsink";
cv::VideoCapture *cap = new cv::VideoCapture();
*cap=cv::VideoCapture(ss, cv::CAP_GSTREAMER);
cap->open(ss, cv::CAP_GSTREAMER);
while(true){
cap->open(ss, cv::CAP_GSTREAMER);
cv::Mat mat;
cap->read(mat);
mat.release();
cap->release();
sleep(120);
}}
Thank you for your help.
↧
how to detect the center of the virtual quadrangle


I wanna use the harris or contour to detect, but the effect is not so good.
↧
Not a god match
Hello everyone!
It's my first time with opencCV and I'm trying to get the phone's camera to recognize a stored object whose image is stored in the assets folder.
When I find that objection, I want you to launch a new activty. My problem is that it launches the activity always, as soon as the camera appears it launches the new activity, so the match it makes is not very good.
I leave the code, thanks:
public class Main3Activity extends Activity implements CameraBridgeViewBase.CvCameraViewListener2 { private static final String TAG = "OCVSample::Activity"; private int w, h; private CameraBridgeViewBase mOpenCvCameraView; TextView tvName; Scalar RED = new Scalar(255, 0, 0); Scalar GREEN = new Scalar(0, 255, 0); FeatureDetector detector; DescriptorExtractor descriptor; DescriptorMatcher matcher; Mat descriptors2,descriptors1; Mat img1; MatOfKeyPoint keypoints1,keypoints2; static { if (!OpenCVLoader.initDebug()) Log.d("ERROR", "Unable to load OpenCV"); else Log.d("SUCCESS", "OpenCV loaded"); } private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Override public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { Log.i(TAG, "OpenCV loaded successfully"); mOpenCvCameraView.enableView(); try { initializeOpenCVDependencies(); } catch (IOException e) { e.printStackTrace(); } } break; default: { super.onManagerConnected(status); } break; } } }; private void initializeOpenCVDependencies() throws IOException { mOpenCvCameraView.enableView(); detector = FeatureDetector.create(FeatureDetector.ORB); descriptor = DescriptorExtractor.create(DescriptorExtractor.ORB); matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING); img1 = new Mat(); AssetManager assetManager = getAssets(); InputStream istr = assetManager.open("ajustes.png"); Bitmap bitmap = BitmapFactory.decodeStream(istr); Utils.bitmapToMat(bitmap, img1); Imgproc.cvtColor(img1, img1, Imgproc.COLOR_RGB2GRAY); img1.convertTo(img1, 0); //converting the image to match with the type of the cameras image descriptors1 = new Mat(); keypoints1 = new MatOfKeyPoint(); detector.detect(img1, keypoints1); descriptor.compute(img1, keypoints1, descriptors1); } public Main3Activity() { Log.i(TAG, "Instantiated new " + this.getClass()); } /** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "called onCreate"); super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_main3); mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial1_activity_java_surface_view); mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE); mOpenCvCameraView.setCvCameraViewListener(this); tvName = (TextView) findViewById(R.id.text1); } @Override public void onPause() { super.onPause(); if (mOpenCvCameraView != null) mOpenCvCameraView.disableView(); } @Override public void onResume() { super.onResume(); if (!OpenCVLoader.initDebug()) { Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization"); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback); } else { Log.d(TAG, "OpenCV library found inside package. Using it!"); mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS); } } public void onDestroy() { super.onDestroy(); if (mOpenCvCameraView != null) mOpenCvCameraView.disableView(); } public void onCameraViewStarted(int width, int height) { w = width; h = height; } public void onCameraViewStopped() { } public Mat recognize(Mat aInputFrame) { Imgproc.cvtColor(aInputFrame, aInputFrame, Imgproc.COLOR_RGB2GRAY); descriptors2 = new Mat(); keypoints2 = new MatOfKeyPoint(); detector.detect(aInputFrame, keypoints2); descriptor.compute(aInputFrame, keypoints2, descriptors2); // Matching MatOfDMatch matches = new MatOfDMatch(); if (img1.type() == aInputFrame.type()) { matcher.match(descriptors1, descriptors2, matches); } else { return aInputFrame; } ListmatchesList = matches.toList(); Double max_dist = 0.0; Double min_dist = 100.0; for (int i = 0; i < matchesList.size(); i++) { Double dist = (double) matchesList.get(i).distance; if (dist < min_dist) min_dist = dist; if (dist > max_dist) max_dist = dist; } LinkedList good_matches = new LinkedList (); for (int i = 0; i < matchesList.size(); i++) { if (matchesList.get(i).distance <= (1.5 * min_dist)) good_matches.addLast(matchesList.get(i)); } MatOfDMatch goodMatches = new MatOfDMatch(); goodMatches.fromList(good_matches); Mat outputImg = new Mat(); MatOfByte drawnMatches = new MatOfByte(); if (aInputFrame.empty() || aInputFrame.cols() < 1 || aInputFrame.rows() < 1) { return aInputFrame; } else { Intent intent = new Intent(this, Blanca.class); startActivity(intent); } Features2d.drawMatches(img1, keypoints1, aInputFrame, keypoints2, goodMatches, outputImg, GREEN, RED, drawnMatches, Features2d.NOT_DRAW_SINGLE_POINTS); Imgproc.resize(outputImg, outputImg, aInputFrame.size()); return outputImg; } public Mat onCameraFrame(CvCameraViewFrame inputFrame) { return recognize(inputFrame.rgba()); } }
↧
↧
please help in my code cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv\modules\objdetect\src\cascadedetect.cpp:1698: error: (-215:Assertion failed) !empty() in function 'cv::CascadeClassifier::detectMultiScale'
my code is
import cv2
faceCascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
cap=cv2.VideoCapture(0)
while True:
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(gray, scaleFactor = 1.05, minNeighbors = 5)
for (x,y,w,h) in faces:
cv2.rectangle(frame,(x,y),(x+w,y+h),(0,255,0),2)
cv2.imshow("frame",frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
↧
DroidCam with OpenCV
With my previous laptop (Windows7) I was connecting to my phone using videoCapture in OpenCV with Visual Studio, and there was no problem. But now I have a laptop with Windows 10, and when I connect the same way it shows orange screen all the time. Actually DroidCam app in my laptop works fine, it shows the recording. However while using OpenCV videoCapture from Visual Studio it shows orange screen.
Thanks in advance
↧
Find the center of mass of cells and crop the image
I am trying to make a program to analyze cell nucleus, but in order to do so, I need to isolate each nucleus and crop the image in a way that each nucleus will be centered (its center of mass will be in the middle).
The image looks like this:

So far I have created the following code, which puts the squares around the biggest contours found in the image. But that's not really what I wanted...
import cv2
import numpy as np
import tiffcapture as tc
class SelectNucleus(it.ImageTools):
tiff = None
img = None
def __init__(self, path):
"""Load image etc."""
self.tiff = tc.opentiff(path)
self.img = self.tiff.read()[1]
self.img = np.array(self.img, dtype=np.uint8)
def split_nucleus(self):
"""split image and into few parts, one neclues in each"""
_, thresh = cv2.threshold(self.img, 100, 255, 0)
kernel = np.ones((2, 2), np.uint8)
thresh = cv2.erode(thresh, kernel, iterations=1)
kernel = np.ones((10, 10), np.uint8)
thresh = cv2.dilate(thresh, kernel, iterations=1)
cv2.imshow('a', self.img)
self.img, contours, hierarchy = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
big_contour = []
max = 0
for i in contours:
area = cv2.contourArea(i) # --- find the contour having biggest area ---
if (area > 5000):
max = area
big_contour.append(i)
self.img = cv2.cvtColor(self.img, cv2.COLOR_GRAY2RGB)
# draw rectangles around contours
for contour in big_contour:
(x, y, w, h) = cv2.boundingRect(contour)
cv2.rectangle(self.img, (x, y), (x + w, y + h), (0, 255, 0), 2)
cv2.drawContours(self.img, big_contour, -1, (255, 0, 0), 3)
cv2.imshow('i', self.img)
cv2.waitKey(0)
a = sn.SelectNucleus('1-4.tif')
a.split_nucleus()
The output looks like this:

Do you have any ideas on how to do it?
Thanks
↧
Saving trained model using surface_matching algorithm
Hi to all the community.
I'm beginner in this fantastic world about OpenCV. I'm making a simple app to estimate the pose of object 3D inside a scene. Reading all the extra modules, I realized "surface matching" module just make this function. Reviewing the code, i have the next doubt: I'm realizing when I'm running th this sample script: (https://github.com/opencv/opencv_contrib/blob/master/modules/surface_matching/samples/ppf_load_match.cpp), the model is trained but none "file" (as XML, DAT or anyway extension) is saved for next poses detection of the model inside the scene. Threre several properties and mats which is saved inside a object called "detection" apart of the of hash_table and I'm not able to save whole mandatory information in any kind of file in disk. Every execution, I need to train the model to obtain the result, so my question is simple. Is there any option to serialize the trained model on disk to use it then for poses detection?
I'm using latest version of OpenCV -> 3.4.3 compiled against VS2017 using Windows 10
Thanks in advance.
↧
↧
Help to build only selected modules for android
I am trying to build *.so files for android modules which iam looking are core,imgproc and java files.
Below code works fine it generates java wrapper files which here is "libopencv_java400.so"
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_LIST=${OPEN_CV_BUILD_MODULES} -D BUILD_ANDROID_PROJECTS=OFF -D WITH_FFMPEG=OFF -D WITH_IPP=OFF -D WITH_OPENEXR=OFF -D BUILD_EXAMPLES=OFF -D BUILD_ANDROID_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=OFF -D BUILD_DOCS=OFF -D BUILD_opencv_python2=OFF -D BUILD_opencv_python3=OFF -D BUILD_SHARED_LIBS=OFF -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF .. && make -j8
But when i run to generate for arm64 it doesnt generate java files and libopencv_java400.so file
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D ANDROID=ON \
-D ANDROID_ABI="arm64-v8a" \
-D BUILD_LIST="imgproc,java" \
-D BUILD_ANDROID_PROJECTS=OFF \
-D BUILD_SHARED_LIBS=ON \
-D CMAKE_TOOLCHAIN_FILE=../platforms/android/android.toolchain.cmake \
-D ANDROID_NATIVE_API_LEVEL=19 \
-D ANDROID_FORCE_ARM_BUILD=OFF \
-D ANDROID_STL_FORCE_FEATURES=OFF \
.. &&\
make -j$NUM_CORES && \
make install
Can any one share working cmake code to geneate.
Thank you
here is my dockerfile code
https://gist.githubusercontent.com/Rajeshr34/43fc08179bcb8c787d6630e0dd926a74/raw/788c41f4699ba72ee0c31eea025d2852d2c720bd/DockerFile
↧
opencv error in windows server
Can openCV use in windows server?
I try to use openCV in windows server 2012 64bit OS.
but it need MediaFeaturePack.
but MediaFeaturePack only windows10 version.
How to do with this problem?
thanks!
↧
can anyone help me where can i get opencv_core341d.lib file??
can anyone help me where can i get opencv_core341d.lib file??
↧
I want install opencv 3.4
I would like to install opencv 3.4. However, opencv 4.0 is installed.
If you use 'git clone https://github.com/opencv/opencv.git' in 'Downloading OpenCV' in "https://docs.opencv.org/3.4.1/d2/de6/tutorial_py_setup_in_ubuntu.html" 4.0 This is the install.
I`m using tensorflow.
I got the file from Github and tried to install it. However, an installation error occurs.
Please!! I need you help😞
↧
↧
How to make fisheye undistort getting the full image?
I am having the same issue with https://stackoverflow.com/questions/34316306/opencv-fisheye-calibration-cuts-too-much-of-the-resulting-image
But did not get the correct result from the answers.
I tried:
cv::fisheye::undistortImage(distort,
undistort,
intrinsicMatrix,
distortionCoeffs,
intrinsicMatrix);
and
cv::fisheye::initUndistortRectifyMap(intrinsicMatrix,
distortionCoeffs,
cv::Matx33d::eye(),
intrinsicMatrix,
distort.size(),
CV_16SC2,
map1,
map2);
cv::remap(distort, undistort, map1, map2, cv::INTER_LINEAR);
I find increase `distort.size()` did work, scale the output image. But I want to display the complete image(not adjust the size).
Is there a standard official demo for fisheye? or a normal default way to undistort the entire image not only the centre part.
BTW What is parameter `R Rectification transformation` of `initUndistortRectifyMap`?
↧
Constancy of const cv::Mat
One of the possibilities of changing the cv::Mat would be to take part of the data with ROI and change their values what in the end would mean, that the values of original cv::Mat were changed. Is it somehow possible that such operation (or any other, which I didn't think about, excluding some dirty tricks with casting) would change the values of the const cv::Mat or can I assume that this will not be allowed and every const Mat is actually constant?
The problem could be that under the hood we are dealing with smart pointers, but maybe this is not an issue, it was somehow taken care of?
↧
OpenCV and hikvision machine vision GiGE camera
I have HikVision machine vision camera MV-CA050-10GC. I guess that the camera does not expose http and rtsp channels the same as conventional cameras and I have to integrate the camera using GiGE. Does openCV has wrapper for hikvision machine GiGE cameras or I have to use hikvision native driver and its SDK to get image/video to OpenCV?
↧