2020-09-25 02:20:54 -0600
| received badge | ● Famous Question
(source)
|
2020-05-27 06:43:32 -0600
| received badge | ● Famous Question
(source)
|
2020-04-29 17:18:57 -0600
| received badge | ● Notable Question
(source)
|
2020-02-16 22:42:37 -0600
| received badge | ● Popular Question
(source)
|
2019-11-18 14:46:42 -0600
| received badge | ● Popular Question
(source)
|
2019-01-09 14:20:05 -0600
| received badge | ● Notable Question
(source)
|
2018-03-20 03:29:57 -0600
| received badge | ● Notable Question
(source)
|
2018-03-14 17:41:45 -0600
| received badge | ● Student
(source)
|
2018-03-14 17:39:39 -0600
| received badge | ● Popular Question
(source)
|
2017-07-02 07:54:59 -0600
| received badge | ● Popular Question
(source)
|
2016-11-19 19:34:23 -0600
| commented question | opencv3.1.0-dev ? I downloaded the latest from web , I tried using the github version but it was not compiling .
since I have all my modules found I will just live with it for now , don't want to break the running opencv
thanks for your time n help |
2016-11-19 19:30:18 -0600
| commented answer | cant find 'BackgroundSubtractorMOG2' opencv3.1.0 |
2016-11-19 19:22:30 -0600
| asked a question | cant find 'BackgroundSubtractorMOG2' opencv3.1.0 sorry after closing the previous thread I tested and I can't find the "'BackgroundSubtractorMOG2'" module ?
I have the MOG and GMG in the sv2.bgsegm though. [root@hadoop1 scripts]# python
Python 3.3.3 (default, Nov 16 2016, 14:57:45)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> fpbg=cv2.BackgroundSubtractorMOG2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'BackgroundSubtractorMOG2'
>>> import cv2.bgsegm
>>> fpbg=cv2.BackgroundSubtractorMOG2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'BackgroundSubtractorMOG2'
>>>
|
2016-11-19 19:01:12 -0600
| commented question | cant play the saved video the CVID codec worked for me , and I found it by entering a "-1" instead of the codec and then manually selected the right codec.
thanks for your help and advise as always |
2016-11-19 18:52:45 -0600
| commented question | opencv3.1.0-dev ? ok I understand now .
thanks a lot |
2016-11-19 18:25:14 -0600
| asked a question | opencv3.1.0-dev ? check this site from openCV its saying the version as "3.1-0-dev" , is this a different version than the one I have installed and if yes where can I download it or is it a matter of just the right CMAKE options ? The background subtraction function location they are showing are different from what I have , mine are in "cv2.bgsegm" Also the site is showing three modules for subtraction where as I have only two if I do " >>>help(cv2.bgsegm)
"createBackgroundSubtractorGMG" and "createBackgroundSubtractorMOG" (http://docs.opencv.org/trunk/db/d5c/t...) [root@hadoop1 build]# python
Python 3.3.3 (default, Nov 16 2016, 14:57:45)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.1.0'
>>>
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_NEW_PYTHON_SUPPORT=ON -DWITH_TBB=ON -DBUILD_TBB=ON -DWITH_OPENGL=ON -DWITH_EIGEN=ON -DFFMPEG_INCLUDE_DIR=/usr/local/include -DOPENCV_EXTRA_MODULES_PATH=/root/opencv_contrib/modules -DBUILD_opencv_legacy=OFF ..
|
2016-11-19 13:31:38 -0600
| commented answer | cmake failing with hash mismatch thanks it worked now
you can add your comment as an answer since I don't want to take the credit .
I have opened a new case since now the make is failing . :( if you can kindly look at that |
2016-11-19 09:06:16 -0600
| asked a question | cmake failing with cannot convert error I am on centos6.8 and trying to build an opencv3.x-dev environment but cmake is failing with following error cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_NEW_PYTHON_SUPPORT=ON -DWITH_TBB=ON -DBUILD_TBB=ON -DWITH_OPENGL=ON -DWITH_EIGEN=ON -DFFMPEG_INCLUDE_DIR=/usr/local/include -DOPENCV_EXTRA_MODULES_PATH=/root/opencv_contrib/modules -DBUILD_opencv_legacy=OFF ..
[ 80%] Generating precomp.hpp.gch/opencv_aruco_RELEASE.gch
[ 80%] Built target pch_Generate_opencv_aruco
Scanning dependencies of target opencv_aruco
[ 80%] Building CXX object modules/aruco/CMakeFiles/opencv_aruco.dir/src/aruco.cpp.o
/root/opencv_contrib/modules/aruco/src/aruco.cpp: In function ‘double cv::aruco::calibrateCameraAruco(const cv::_InputArray&, const cv::_InputArray&, const cv::_InputArray&, const cv::Ptr<cv::aruco::Board>&, cv::Size, const cv::_InputOutputArray&, const cv::_InputOutputArray&, const cv::_OutputArray&, const cv::_OutputArray&, const cv::_OutputArray&, const cv::_OutputArray&, const cv::_OutputArray&, int, cv::TermCriteria)’:
/root/opencv_contrib/modules/aruco/src/aruco.cpp:1585: error: cannot convert ‘const cv::_OutputArray’ to ‘int’ for argument ‘8’ to ‘double cv::calibrateCamera(const cv::_InputArray&, const cv::_InputArray&, cv::Size, const cv::_InputOutputArray&, const cv::_InputOutputArray&, const cv::_OutputArray&, const cv::_OutputArray&, int, cv::TermCriteria)’
make[2]: *** [modules/aruco/CMakeFiles/opencv_aruco.dir/src/aruco.cpp.o] Error 1
make[1]: *** [modules/aruco/CMakeFiles/opencv_aruco.dir/all] Error 2
make: *** [all] Error 2
[root@hadoop1 build]#
|
2016-11-19 08:28:20 -0600
| commented question | cmake failing with hash mismatch ok I found all the files at this URL link text |
2016-11-19 08:10:21 -0600
| commented question | cmake failing with hash mismatch I replaced the bootdesc_bgm.I with the file from the url you sent and it accepted it . but now its complaining about another file "bootdesc_bgm_bi.I" can you also send me the url for this one as if I google it I get no links .
thanks |
2016-11-18 22:43:19 -0600
| commented question | cmake failing with hash mismatch I checked your URL but they are only file names and not the file itself. Can you or someone send me this file please ?
my curl version is : [admin@hadoop1 atlas]$ curl --version
curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
[admin@hadoop1 atlas]$
|
2016-11-18 18:51:49 -0600
| asked a question | cmake failing with hash mismatch I am trying to build opencv but cmake is failing with the following error , i have had this before and i could find the files and manually put them on the server but this time this file "bootdesc_bgm.i" is no where to be found , please help.
I even upgraded my cmake to 3.0 . -- Check contents of boostdesc_bgm.i ...
-- Downloading boostdesc_bgm.i...
CMake Error at /root/opencv/cmake/OpenCVUtils.cmake:895 (file):
file DOWNLOAD HASH mismatch
for file: [/root/opencv_contrib/modules/xfeatures2d/cmake/.download/0ea90e7a8f3f7876d450e4149c97c74f/boostdesc_bgm.i]
expected hash: [0ea90e7a8f3f7876d450e4149c97c74f]
actual hash: [d41d8cd98f00b204e9800998ecf8427e]
status: [1;"unsupported protocol"]
here is the cmake command i am using cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_NEW_PYTHON_SUPPORT=ON -DWITH_TBB=ON -DBUILD_TBB=ON -DWITH_OPENGL=ON -DWITH_EIGEN=ON -DFFMPEG_INCLUDE_DIR=/usr/local/include -DOPENCV_EXTRA_MODULES_PATH=/root/opencv_contrib/modules -DBUILD_opencv_legacy=OFF ..
|
2016-11-18 16:00:11 -0600
| asked a question | creating mp4 file in linux I can read and play the file but when I write a mp4 or even avi video its not playable . I have confirmed that ffmpeg can create the video fine so why from openCV its not working?
iam using openCV 3.1.0 and python 3.3 ffmpeg -i /tmp/kyak.mp4 -vcodec libx264 -f mp4 /tmp/a.mp4
the code below produces the file but it contains zero frame as shown by ffmpeg command . import numpy as np
import cv2
cap = cv2.VideoCapture('/tmp/kyak.mp4')
fourcc = cv2.VideoWriter_fourcc('X','2','6','4')
out = cv2.VideoWriter('/tmp/output.mp4',fourcc, 20.0, (640,480))
while (cap.isOpened()):
ret,frame=cap.read()
if ret == True:
gray = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
#write the gray frame
out.write(gray)
cv2.imshow('frame',gray)
if cv2.waitKey(30) & 0xFF == ord('q'):
break
else:
break
cap.release()
out.release()
cv2.destroyAllWindows()
The video plays but I get this error from the code above : OpenCV: FFMPEG: tag 0x34363258/'X264' is not supported with codec id 28 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x00000021/'!???'
if I replace the "fourcc" with "0x00000021" then the error goes away but still the produced file has zero frame . [root@hadoop1 scripts]# ffmpeg -i /tmp/output.mp4
ffmpeg version N-82533-gae514b1 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
configuration: --enable-libx264 --enable-gpl --enable-shared
libavutil 55. 40.100 / 55. 40.100
libavcodec 57. 66.105 / 57. 66.105
libavformat 57. 57.100 / 57. 57.100
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 67.100 / 6. 67.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.57.100
Duration: 00:00:00.00, bitrate: N/A
|
2016-11-17 12:11:30 -0600
| received badge | ● Enthusiast
|
2016-11-14 04:48:25 -0600
| received badge | ● Self-Learner
(source)
|
2016-11-13 17:09:06 -0600
| asked a question | cant play the saved video I have tried many codecs , all but the last one produce 0 bytes video, the last codec does produce a video file with some but then its not playable . This problem is driving me crazy , The code I am using is tested by other users n working.
I have copied the opencv_ffmpeg310_64.dll file into the c:\python2.7 folder.
I am on windows 10 and opencv 3.1.0
I tried all types of CODEC none are working. import numpy as np
import cv2
cap = cv2.VideoCapture(0)
# Define the codec and create VideoWriter object
# Define the codec and create VideoWriter object
#fourcc = cv2.VideoWriter_fourcc(*'FFV1')
#fourcc = cv2.VideoWriter_fourcc(*'XVID')
#fourcc = cv2.VideoWriter_fourcc(*'DIVX')
#fourcc = cv2.VideoWriter_fourcc(*'DIV3')
#fourcc = cv2.VideoWriter_fourcc('F','M','P','4')
#fourcc = cv2.VideoWriter_fourcc('D','I','V','X')
#fourcc = cv2.VideoWriter_fourcc('D','I','V','3')
#fourcc = cv2.VideoWriter_fourcc('F','F','V','1')
fourcc = cv2.VideoWriter_fourcc('M','J','P','G')
out = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480))
while(cap.isOpened()):
ret, frame = cap.read()
if ret==True:
frame = cv2.flip(frame,0)
# write the flipped frame
out.write(frame)
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
# Release everything if job is finished
cap.release()
out.release()
cv2.destroyAllWindows()
|
2016-11-12 01:04:33 -0600
| answered a question | DetectFaceDemo only working on one picture as Berak pointed out the program was not detecting the face because of the tilt in the head of more than 20 deg .
so its not broken , its working as designed. |
2016-11-12 01:02:12 -0600
| answered a question | running java class issue found the solution online : put the following in the code to finD the classpath and copy the "xml" and "png" files to this location . System.out.println(System.getProperty("java.class.path")); |
2016-11-12 00:59:48 -0600
| answered a question | unable to compile java opencv file the issue is fixed by using the build file (I found on web) and copying the opencv-248.jar in the ./lib folder build.sbt DetectFaceDemo.java lib project target [root@hadoop1 java]# more build.sbt name := "opencv_usage_scala"
scalaVersion := "2.11.6"
scalacOptions ++= Seq( "-unchecked", "-deprecation", "-optimize", "-Xlint" )
javaOptions in run += "-Djava.library.path=./lib"
lazy val root = (project in file("."))
fork := true
|
2016-11-12 00:31:53 -0600
| asked a question | cant play video file I can display an image file fine after setting the DISPLAY variable but when I try to run the following video code from the opencv site , I get nothing , no video window is opened ?
the demo I am following is : http://opencv-python-tutroals.readthe... please see the code and the output below : [root@hadoop1 basic-motion-detection]# more demo1.py
import numpy as np
import cv2
cap = cv2.VideoCapture('/home/admin/example_02.mp4')
print cap.get(5) #to display frame rate of video
#print cap.get(cv2.cv.CV_CAP_PROP_FPS)
while(cap.isOpened()):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) #convert to grayscale
cv2.imshow('frame',gray)
waitKey(50)
if cv2.waitKey(25) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
[root@hadoop1 basic-motion-detection]# python demo1.py
0.0
[root@hadoop1 basic-motion-detection]#
I modified the above code and added the creation of window (as its used in the display image example) , but to no use. [root@hadoop1 basic-motion-detection]# more demo1.py
import numpy as np
import cv2
cap = cv2.VideoCapture('/home/admin/example_02.mp4')
while(cap.isOpened()):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.startWindowThread()
cv2.namedWindow("preview")
cv2.imshow('preview',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
|
2016-11-10 10:41:15 -0600
| commented question | DetectFaceDemo only working on one picture looking at the last picture I loaded , do you think its tilted that's why the area detected is very small ?
also is there any program example in openCV that can detect animal shapes like dog or cat etc? |
2016-11-10 10:36:27 -0600
| commented question | DetectFaceDemo only working on one picture added another picture , the program also failed to detect the complete face but detected and marked just the eye area. ? |
2016-11-10 10:12:03 -0600
| commented question | DetectFaceDemo only working on one picture also is it supposed to only detect faces in upright position ? I rotated the Donald Trump image 90 deg and then it only draws a small rectangle around the eye area and not the complete face , please see attached picture. |
2016-11-10 10:04:05 -0600
| commented question | DetectFaceDemo only working on one picture sure will do!
in meantime I downloaded a picture of Donald Trump and it works. so something wrong with the English queen :) can someone try to use this picture (I uploaded it ) and see why this program does not detect face on it ? |
2016-11-10 09:49:24 -0600
| commented question | DetectFaceDemo only working on one picture here I proved that it has to be the file because I didn't modify the code and just replace the file queen.png with lena1.png and it detects the face .
i have uploaded the image file so you can test if you can read it ? |
2016-11-10 09:48:43 -0600
| edited question | DetectFaceDemo only working on one picture C:\fakepath\queen.png DONALD-ROTATED only eye detected I am using the following tutorial
DetectFaceDemo but it only works on the lena.jpg picture that comes with the demo . I tried other pics even converting them to the same resolution and size as lena.jpg but it doesn't detect the face .
how can I make it work on other pictures? [root@hadoop1 java]# more HelloOpenCV.java
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.highgui.Highgui;
import org.opencv.objdetect.CascadeClassifier;
// Detects faces in an image, draws boxes around them, and writes the results
// to "faceDetection.png".
//
class DetectFaceDemo {
public void run() {
System.out.println("\nRunning DetectFaceDemo");
System.out.println(System.getProperty("java.class.path"));
//
//
// Create a face detector from the cascade file in the resources
// directory.
CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath());
Mat image = Highgui.imread(getClass().getResource("queen.png").getPath());
// Detect faces in the image.
// MatOfRect is a special container class for Rect.
MatOfRect faceDetections = new MatOfRect();
faceDetector.detectMultiScale(image, faceDetections);
System.out.println(String.format("Detected %s faces", faceDetections.toArray().length));
// Draw a bounding box around each face.
for (Rect rect : faceDetections.toArray()) {
Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0));
}
// Save the visualized detection.
String filename = "faceDetection.png";
System.out.println(String.format("Writing %s", filename));
Highgui.imwrite(filename, image);
}
}
public class HelloOpenCV {
public static void main(String[] args) {
System.out.println("Hello, OpenCV");
// Load the native library.
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
new DetectFaceDemo().run();
}
}
[root@hadoop1 java]#
see below , I am just changing the picture file name , recompiling and running the same code, with lena1.png I get "Detected 1 face" ,but with queen.png I get "Detected 0 faces" [root@hadoop1 java]# grep png HelloOpenCV.java
// to "faceDetection.png".
Mat image = Highgui.imread(getClass().getResource("lena1.png").getPath());
String filename = "faceDetection.png";
[root@hadoop1 java]# sbt run
[info] Set current project to DetectFaceDemo (in build file:/root/openCV/opencv/samples/java/sbt/src/main/java/)
[info] Running HelloOpenCV
[info] Hello, OpenCV
[info]
[info] Running DetectFaceDemo
[info] /root/openCV/opencv/samples/java/sbt/src/main/java/target/scala-2.11/classes:/root/openCV/opencv/samples/java/sbt/src/main/java/lib/libopencv_java249.so:/root/openCV/opencv/samples/java/sbt/src/main/java/lib/opencv-249.jar:/root/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.6.jar
[info] Detected 1 faces
[info] Writing faceDetection.png
[success] Total time: 1 s, completed Nov 10, 2016 10:08:29 AM
[root@hadoop1 java]# grep png HelloOpenCV.java
// to "faceDetection.png".
Mat image = Highgui.imread(getClass().getResource("queen.png").getPath());
String filename = "faceDetection.png";
[root@hadoop1 java]# sbt compile
[info] Set current project to DetectFaceDemo (in build file:/root/openCV/opencv/samples/java/sbt/src/main/java/)
[info] Compiling 1 Java source to /root/openCV ... (more) |
2016-11-10 09:47:09 -0600
| commented question | DetectFaceDemo only working on one picture hi Berak the code is not failing though , like I said even without modifying the code if I just replace the files it either detects the face or not . |