Ask Your Question

j0h's profile - activity

2020-10-17 03:04:42 -0600 marked best answer is there a waitkey table?

I'd like to give waitkey commands for any given letter. Imagined there would be a table with (letter == N ) on the waitkey API, but I did not see it. what are the numbers for a,s,d,w respectively? Or is there something that says what each key is someplace?

not sure what I mean? Heres the keypress codes for SDL. https://wiki.libsdl.org/SDL_Keycode Im looking for something like that, buy for the OpenCV waitkey codes

Im looking for C++, but python would be good too, if they are not the same.

2020-09-05 07:16:46 -0600 received badge  Popular Question (source)
2020-05-26 03:49:32 -0600 received badge  Famous Question (source)
2020-04-03 05:18:34 -0600 received badge  Notable Question (source)
2020-01-02 20:13:40 -0600 received badge  Popular Question (source)
2019-11-27 03:40:20 -0600 received badge  Popular Question (source)
2019-10-18 06:29:49 -0600 received badge  Famous Question (source)
2018-10-21 09:46:28 -0600 received badge  Nice Question (source)
2018-10-01 11:25:34 -0600 marked best answer Is there a way to set new window position?

If I create 2 new windows, using imshow() the new windows will overlap eachother every time I load the application.

it would be nifty if I could set the initial window location with a coordinate. Should I just export the content of the windows to OpenGL, or SDL or something like that, instead?

2018-06-25 05:36:07 -0600 received badge  Notable Question (source)
2018-05-22 10:12:06 -0600 received badge  Notable Question (source)
2018-04-22 01:49:36 -0600 received badge  Famous Question (source)
2018-04-18 03:40:36 -0600 received badge  Notable Question (source)
2018-01-24 04:44:27 -0600 received badge  Popular Question (source)
2017-12-18 08:07:07 -0600 received badge  Famous Question (source)
2017-12-16 08:39:09 -0600 received badge  Notable Question (source)
2017-12-06 06:25:18 -0600 received badge  Popular Question (source)
2017-11-14 10:15:23 -0600 received badge  Popular Question (source)
2017-10-26 05:33:19 -0600 received badge  Popular Question (source)
2017-09-13 10:35:42 -0600 received badge  Notable Question (source)
2017-08-08 18:51:17 -0600 marked best answer Does OpenCV forum have a Chat page?

I'd like to know if this site has a chat page. I have some questions I'm not sure warrant a full question.

2017-08-07 07:34:53 -0600 received badge  Popular Question (source)
2017-04-09 17:41:59 -0600 received badge  Student (source)
2017-01-30 21:58:54 -0600 asked a question Does OpenCV suppport animated png?

Does OpenCV suppport animated png? I looked in the documentations, under imwrite, but did not see anything, but perhaps I missed something.

2017-01-30 21:49:04 -0600 commented question animated gif support

2017 and Still no support, for gif. but perhaps an animated png is doable.

2017-01-30 21:09:33 -0600 asked a question How can I save a video for a length of time?

I have a video stream going, and object detection. If I detect an object, I want to stop detecting, save video for N seconds. I wrote a function, but its not right. After naming the file based on date and time, I'm not sure what to do. There is only 1 camera, and I am working on a linux system.

Should I close the existing video stream, then open another and save video for N seconds?

If I interrupt the video stream, I will get quality issues related to exposure, in the first few frames. Exposure settings are not supported on my camera in openCV.

I tried appending a stream and also tried saving a separate stream concurrently, but both resulted in problems.

Is there a preferred method to save parts of a video stream without interrupting the stream? if there is, can i get an example of that?

2017-01-27 08:59:41 -0600 asked a question what might cause problems with openCV linking?

I followed some instructions for installing openCV3, the same ones I usually follow, and it would seem openCV3 is installed. but every program I write returns errors on compiling. The same programs work fine everywhere else i run them. this would be:

 git clone https://github.com/opencv/opencv.git

cd opencv
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j 4
sudo make install
sudo ldconfig

I am on linux, and my compile/ build flags are:

g++ -Wall -g `pkg-config --cflags --libs opencv` -o file file.cpp

I have tried purging, uninstalling, deleting old opencv versions, with reboots, but after installing, and yes, I have run sudo ldconfig when I try to compile, I get this:

 g++ Wall -g `pkg-config --cflags --libs opencv` -o test test.cpp 
/tmp/cchudewP.o: In function `main':
/home/jay/Desktop/test.cpp:7: undefined reference to `cv::imread(cv::String const&, int)'
/home/jay/Desktop/test.cpp:11: undefined reference to `cv::namedWindow(cv::String const&, int)'
/home/jay/Desktop/test.cpp:12: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
/home/jay/Desktop/test.cpp:13: undefined reference to `cv::waitKey(int)'
/home/jay/Desktop/test.cpp:14: undefined reference to `cv::destroyWindow(cv::String const&)'
/tmp/cchudewP.o: In function `cv::String::String(char const*)':
/usr/local/include/opencv2/core/cvstd.hpp:622: undefined reference to `cv::String::allocate(unsigned long)'
/tmp/cchudewP.o: In function `cv::String::~String()':
/usr/local/include/opencv2/core/cvstd.hpp:664: undefined reference to `cv::String::deallocate()'
/tmp/cchudewP.o: In function `cv::String::operator=(cv::String const&)':
/usr/local/include/opencv2/core/cvstd.hpp:672: undefined reference to `cv::String::deallocate()'
/tmp/cchudewP.o: In function `cv::Mat::~Mat()':
/usr/local/include/opencv2/core/mat.inl.hpp:592: undefined reference to `cv::fastFree(void*)'
/tmp/cchudewP.o: In function `cv::Mat::release()':
/usr/local/include/opencv2/core/mat.inl.hpp:704: undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status

basically, every call to anything openCV fails.

I have looked for the opencv libraries, and they are in the appropriate place:

ls  -al /usr/local/include/opencv2/*.hpp 
-rw-r--r-- 1 root root  27236 Jan 26 20:12 /usr/local/include/opencv2/aruco.hpp
-rw-r--r-- 1 root root   7518 Jan 26 20:12 /usr/local/include/opencv2/bgsegm.hpp
...

They are there.

I have tried all the things I know how to do, and I get the same issue every-time. I am on Ubuntu, if anyone can help me get oopencv installed so I can compile programs, I would be grateful.

2017-01-25 01:43:52 -0600 asked a question how can I set VideoCapture attributes with set?

I am trying to adjust the gain in a simple camera function

void imgGet(){

    cv::VideoCapture cap(0);
    double k=0.99;
    cap.set(CAP_PROP_EXPOSURE,1); 
    Mat frame;
    cap >> frame;
    string fileName = getFName();
    imwrite(fileName, frame);
    }

Ive tried a variety of things, but the error I get is:

VIDIOC_S_CTRL: Invalid argument

I don't know what that means, how am I supposed to set the VideoCapture::set object? I have seen the videocapture documentation

but I didnt understand it in a useful way. I am on a Linux PC. despite the error, an image is still taken, but the image quality is unchanged.

2017-01-18 09:58:43 -0600 asked a question How can I get the raspberry Pi camera working with c++ on OpenCV3?

I was pleased to read about the addition of ARM support in the Opencv 3 change log, and decided to try installing OpenCV3.2 on my raspberry Pi. The installation appears to have been a success, and works with a USB web camera as one might expect. When I try to use the raspberry Pi camera however, it is less intuitive.

I tried installing some separate APIs for supporting the raspberry pi camera, but this did not pan out. I have tested the camera using separate python libraries (piCamera), and it is operational.

Im not exclusively looking for an OpenCV3 support library, but if anyone has done this type of thing and knows a library that has C++ support for the Raspberry Pi Camera, and works with opencv3, I would like to know.

2017-01-17 19:55:06 -0600 asked a question ColorConversionCodes COLOR_GRAY2RGB seems to behave like BGR

This code sample will draw a red circle on a white background. using the ColorConversionCodes COLOR_GRAY2RGB marker, the color identity Scalar(0,0,255) produces red. why not blue? Does the circle function convert the color code back to BGR?

 #include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char ** argv){

    Mat md0, md1, md2;
    md0 = Mat::zeros(200,400,CV_32F);
    md1 = Mat::ones(200,400,CV_32F);

//drawing function
    Point2f p(77, 100);
    cvtColor(md1, md2, COLOR_GRAY2RGB );
    circle( md2, p,50,Scalar(0,0,255),2,8,0);

    imshow("MD2", md2);

    waitKey(0);
    return 0;
    }
2017-01-17 19:27:36 -0600 commented answer why is this circle only black?

The same problem occurs when i use Scalar(255,255,0)

2017-01-17 18:11:42 -0600 asked a question why is this circle only black?

Im trying out the drawing functions, but having difficulty getting the colour I want. The circle appears, on some values, but not others, for color, but only ever shows up as black. What am I doing wrong? I have read the the documentation for the circle function.

I am using opencv 3.2, have tried Scalar(255,255,0) in lieu of a Hex Value. The circle is being drawn, but only in black, or white. When I switch to the all zeros Matrix, i can see a white circle on a black background.

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
using namespace std;
using namespace cv;
int main(int argc, char ** argv){

    Mat md0, md1, md2, md3;
    md0 = Mat::zeros(100,200,CV_32F);
    md1 = Mat::ones(100,200,CV_32F);

    pyrUp(md1,md2);

//drawing function
    Point2f p(77, 100);
    circle( md2, p,50,0xFFFF00,2,8,0);

    imshow("Double Ones", md2);

    waitKey(0);
    return 0;
    }
2017-01-12 18:47:19 -0600 commented question What steps should I take to remove watermarks from color images?

legality is not an issue in said images. oh look, an example!

2017-01-12 14:14:13 -0600 asked a question What steps should I take to remove watermarks from color images?

I read about inpainting, and how I might be able to remove watermarks in images. But there was no example code. So i wrote a program that uses the inpaint function, but I can see no effect on the ouput image. Certainly, I may be missing some steps, on how to do this type of thing properly, and that is what i would like to know.

What steps should I take to remove watermarks from color images? Am I using the inpaint function correctly here?

//g++ -Wall -g -o "restore" "restore.cpp" `pkg-config --cflags --libs opencv`
#include <opencv2/opencv.hpp>
#include "opencv2/imgproc.hpp"
#include <iostream>

using namespace std;
using namespace cv;

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

    if(argc != 2){
        cout << "Repair Image Usage:\n" << argv[0] << " <image name>  \n";
        return -1;
    }

    Mat src = imread(argv[1],1);
    Mat dst(src.size(), src.type()); // destination 

    if(src.empty()){
        cout << "File not found, or un-readable" << argv[1] << "\n";
        return -1;
    } 
    Mat mask;
    cvtColor(src, mask, CV_RGB2GRAY);
    inpaint(src,mask,dst,3,INPAINT_NS );

    imshow("Restored Image",dst); //lol not yet

    waitKey(0);

    return 0;
    }
2016-09-27 07:46:42 -0600 asked a question Drawing with touchscreen

Hello All, I have read the drawing tutorial, and understand how to do some basic drawing functions. I would like to draw using a touchscreen. There a library that can help me do that?

2016-09-19 12:36:42 -0600 asked a question How can I wait unitl the image is done writing?

I have a program, and it takes, and saves a photo at the start of operation. As is, I wait with a sleep, or delay, for an amount of time that Ive observed to be necessary to finish writing the image file completely, before trying to make a read. Surely, this cannot be the best way. unfortunately, I don't see anything that says when the write process is completed.

When writing image files, how can I be certain when the image file is fully saved?

2016-09-13 13:03:54 -0600 marked best answer How can I get an image from a network stream?

I have a streaming web-camera in my office, it is a proprietary consumer electronics product, I did not build it, and I have a somewhat limited access to programing its underlying hardware.

The stream is at (http://someIP/videostream.cgi?user=z&...)

UPDATE: The camera is a FOSSCAM F18910W

and is formated as a series of jpegs. is there any way I can have OpenCV read a network stream? how would I set that up?