Ask Your Question

raisa_'s profile - activity

2020-04-24 00:28:58 -0500 edited question Working with PGM file. Why my generated PGM file has 3 channels (RGB) ?

Working with PGM file. Why my generated PGM file has 3 channels (RGB) ? I tried to generate PGM file, with this : ori =

2020-04-24 00:17:41 -0500 asked a question Working with PGM file. Why my generated PGM file has 3 channels (RGB) ?

Working with PGM file. Why my generated PGM file has 3 channels (RGB) ? I tried to generate PGM file, with this : ori =

2020-04-15 10:34:32 -0500 edited question How do I properly build OpenCV with CUDA support ?

How do I properly build OpenCV with CUDA support ? Anyone successfully build OpenCV with Cuda using CMake on Linux (Ubu

2020-04-15 09:25:12 -0500 edited question How do I properly build OpenCV with CUDA support ?

How do I properly build OpenCV with CUDA support ? Anyone successfully build OpenCV with Cuda using CMake on Linux (Ubu

2020-04-15 09:24:14 -0500 edited question How do I properly build OpenCV with CUDA support ?

How do I properly build OpenCV with CUDA support ? Anyone successfully build OpenCV with Cuda using CMake on Linux (Ubu

2020-04-15 09:23:54 -0500 edited question How do I properly build OpenCV with CUDA support ?

How do I properly build OpenCV with CUDA support ? Anyone successfully build OpenCV with Cuda using CMake on Linux (Ubu

2020-04-15 09:22:25 -0500 asked a question How do I properly build OpenCV with CUDA support ?

How do I properly build OpenCV with CUDA support ? Anyone successfully build OpenCV with Cuda using CMake on Linux (Ubu

2020-03-23 05:17:18 -0500 commented question Failing to lock exposure on Logitech C270

@doctrucker hi, I'm facing the same issue with : GStreamer warning: Cannot query video position: status=0, value=-1, dur

2020-03-11 01:06:18 -0500 commented question How do I set up Qt windows for OpenCV in Ubuntu ?

@mvuori Sure, I've update my question !

2020-03-11 01:03:57 -0500 edited question How do I set up Qt windows for OpenCV in Ubuntu ?

How do I set up Qt windows for OpenCV in Ubuntu ? Hi, I've been following an OpenCV tutorial from a book. Prior to it, I

2020-03-10 16:27:41 -0500 edited question How do I set up Qt windows for OpenCV in Ubuntu ?

How do I set up Qt windows for OpenCV in Ubuntu ? Hi, I've been following an OpenCV tutorial from a book. Prior to it, I

2020-03-10 16:27:14 -0500 edited question How do I set up Qt windows for OpenCV in Ubuntu ?

How do I set up Qt windows for OpenCV in Ubuntu ? Hi, I've been following an OpenCV tutorial from a book. Prior to it, I

2020-03-08 07:37:56 -0500 edited question How do I set up Qt windows for OpenCV in Ubuntu ?

How do I set up Qt windows for OpenCV in Ubuntu ? Hi, I've been following an OpenCV tutorial from a book. Prior to it, I

2020-03-08 07:32:38 -0500 edited question How do I set up Qt windows for OpenCV in Ubuntu ?

How do I set up Qt windows for OpenCV in Ubuntu ? Hi, I've been following an OpenCV tutorial from a book. Prior to it, I

2020-03-08 07:06:29 -0500 edited question How do I set up Qt windows for OpenCV in Ubuntu ?

How do I set up Qt windows for OpenCV in Ubuntu ? Hi, I've been following an OpenCV tutorial from a book. Prior to it, I

2020-03-08 05:12:00 -0500 edited question How do I set up Qt windows for OpenCV in Ubuntu ?

How do I set up Qt windows for OpenCV in Ubuntu ? Hi, I've been following an OpenCV tutorial from a book. Prior to it, I

2020-03-07 16:58:56 -0500 edited question How do I set up Qt windows for OpenCV in Ubuntu ?

How do I set up Qt windows for OpenCV in Ubuntu ? Hi, I've been following an OpenCV tutorial from a book. Prior to it, I

2020-03-07 16:56:43 -0500 edited question How do I set up Qt windows for OpenCV in Ubuntu ?

How do I set up Qt windows for OpenCV in Ubuntu ? Hi, I've been following an OpenCV tutorial from a book. Prior to it, I

2020-03-07 14:46:19 -0500 edited question How do I set up Qt windows for OpenCV in Ubuntu ?

How do I set up Qt windows for OpenCV in Ubuntu ? Hi, I've been following an OpenCV tutorial from a book. Prior to it, I

2020-03-07 14:13:06 -0500 edited question How do I set up Qt windows for OpenCV in Ubuntu ?

How do I set up Qt windows for OpenCV in Ubuntu ? Hi, I've been following an OpenCV tutorial from a book. Prior to it, I

2020-03-07 13:53:28 -0500 edited question How do I set up Qt windows for OpenCV in Ubuntu ?

How do I set up Qt windows for OpenCV in Ubuntu ? Hi, I've been following an OpenCV tutorial from a book. Prior to it, I

2020-03-07 13:07:03 -0500 edited question How do I set up Qt windows for OpenCV in Ubuntu ?

How do I set up Qt windows for OpenCV in Ubuntu ? Hi, I've been following an OpenCV tutorial from a book. Prior to it, I

2020-03-07 12:53:45 -0500 asked a question How do I set up Qt windows for OpenCV in Ubuntu ?

How do I set up Qt windows for OpenCV in Ubuntu ? Hi, I've been following an OpenCV tutorial from a book. Prior to it, I

2020-03-04 15:15:48 -0500 marked best answer Help with "Undefined-reference" when compiling with CMake for OpenCV & C++ program

I'm following a book tutorial to add slider and mouse events to an interface with OpenCV and C++. I'm working in terminal Ubuntu and compile my project with CMake. Here, I have 2 programs, sample1.cpp and sample2.cpp. Now, sample1 worked just fine I can run it properly. When I added sample2 to my CMakeLists and tried to compile it, I encountered this :

[ 25%] Building CXX object CMakeFiles/sample1.dir/sample1.cpp.o
[ 50%] Linking CXX executable sample1
[ 50%] Built target sample1
Scanning dependencies of target sample2
[ 75%] Building CXX object CMakeFiles/sample2.dir/sample2.cpp.o
[100%] Linking CXX executable sample2
CMakeFiles/sample2.dir/sample2.cpp.o: In function `main':
sample2.cpp:(.text+0x15b): undefined reference to `onChange(int, void*)'
sample2.cpp:(.text+0x1ec): undefined reference to `onMouse(int, int, int, int, void*)'
sample2.cpp:(.text+0x229): undefined reference to `onChange(int, void*)'
collect2: error: ld returned 1 exit status
CMakeFiles/sample2.dir/build.make:146: recipe for target 'sample2' failed
make[2]: *** [sample2] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/sample2.dir/all' failed
make[1]: *** [CMakeFiles/sample2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Looks like linker error but I think I have added all the necessary libs. Here's my code to sample2 :

#include <iostream>
#include "opencv2/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc.hpp"
using namespace cv;
using namespace std;

//create variable to save the position of value in track
int blurAmount = 15;

//Trackball call back function
void onChange(int pos, void* userInput);

//Mouse callback
void onMouse(int event, int x, int y, int, void* userInput);

int main(int argc, const char** argv){
         //Read images
         Mat img1 = imread("image_one.jpg");

         //Create windows
         namedWindow("Image1");

         //Create a trackbar --
         createTrackbar("Image1", "Image1", &blurAmount, 30, onChange, &img1);
         setMouseCallback("Image1", onMouse, &img1);

         //Call to onChange to init
         onChange(blurAmount, &img1);

         waitKey(0);
         destroyWindow("Image1");
         return 0;
 }

I believe my CMakeLists isn't the problem here, since it works fine with sample1. But here's my CMakeLists.txt in case it's necessary.

cmake_minimum_required(VERSION 3.0)
PROJECT(Chapter3)

FIND_PACKAGE(OpenCV REQUIRED)
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
LINK_DIRECTORIES(${OpenCV_LIB_DIR})

ADD_EXECUTABLE(sample1 sample1.cpp)
TARGET_LINK_LIBRARIES(sample1 ${OpenCV_LIBS})

ADD_EXECUTABLE(sample2 sample2.cpp)
TARGET_LINK_LIBRARIES(sample2 ${OpenCV_LIBS})

And advice what could be causing those errors ??

2020-03-04 15:15:39 -0500 commented answer Help with "Undefined-reference" when compiling with CMake for OpenCV & C++ program

Ohh, dang. They're just functions declaration. The actual functions are on the next 2 pages on the book. I'm just starte

2020-03-04 12:41:58 -0500 edited question Help with "Undefined-reference" when compiling with CMake for OpenCV & C++ program

Help with "Undefined-reference" when compiling with CMake for OpenCV & C++ program I'm following a book tutorial to

2020-03-04 12:40:53 -0500 edited question Help with "Undefined-reference" when compiling with CMake for OpenCV & C++ program

Help with "Undefined-reference" when compiling with CMake for OpenCV & C++ program I'm following a book tutorial to

2020-03-04 12:38:35 -0500 edited question Help with "Undefined-reference" when compiling with CMake for OpenCV & C++ program

Help with "Undefined-reference" when compiling with CMake for OpenCV & C++ program I'm following a book tutorial to

2020-03-04 12:32:49 -0500 asked a question Help with "Undefined-reference" when compiling with CMake for OpenCV & C++ program

Help with "Undefined-reference" when compiling with CMake for OpenCV & C++ program I'm following a book tutorial to

2020-02-29 12:02:42 -0500 commented question How do I write into YML format and read it with opencv and C++ ?

@LBerger Just tried it. Doesn't work.

2020-02-29 09:59:54 -0500 commented question How do I write into YML format and read it with opencv and C++ ?

@sturkmen Yes ! that's how the output is supposed to be ! But mine is blank, and there's no .yml file generated everywhe

2020-02-28 23:43:00 -0500 commented question How do I write into YML format and read it with opencv and C++ ?

@sturkmen Did you manage to write and read .yml file ? is there any .yml file generated ? I'm also using OpenCV2.

2020-02-28 13:23:23 -0500 edited question How do I write into YML format and read it with opencv and C++ ?

How do I write into YAML format and read it with opencv and C++ ? I'm following an OpenCV book tutorial to write and rea

2020-02-28 13:21:12 -0500 edited question How do I write into YML format and read it with opencv and C++ ?

How do I write into YAML format and read it with opencv and C++ ? I'm following an OpenCV book tutorial to write and rea

2020-02-28 13:19:56 -0500 edited question How do I write into YML format and read it with opencv and C++ ?

How do I write into YML format and read it with opencv and C++ ? I'm following an OpenCV book tutorial to write and read

2020-02-28 13:19:52 -0500 edited question How do I write into YML format and read it with opencv and C++ ?

How do I write into YML format and read it with opencv and C++ ? I'm following an OpenCV book tutorial to write and read

2020-02-28 13:14:56 -0500 edited question How do I write into YML format and read it with opencv and C++ ?

How do I write into YML format and read it with opencv and C++ ? I'm following an OpenCV book tutorial to write and read

2020-02-28 13:11:44 -0500 edited question How do I write into YML format and read it with opencv and C++ ?

How do I write into YML format and read it with opencv and C++ ? I'm following an OpenCV book tutorial to write and read

2020-02-28 13:09:37 -0500 asked a question How do I write into YML format and read it with opencv and C++ ?

How do I write into YML format and read it with opencv and C++ ? I'm following an OpenCV book tutorial to write and read

2019-03-18 13:27:42 -0500 edited question How do I check average brightness from 2 pictures ?

How do I check average brightness from 2 pictures ? I have a picture that have been passing some colorspace computations

2019-03-18 13:27:21 -0500 edited question How do I check average brightness from 2 pictures ?

How do I check average brightness from 2 pictures ? I have a picture that have been passing some colorspace computations

2019-03-18 13:04:03 -0500 edited question How do I check average brightness from 2 pictures ?

How do I check average brightness from 2 pictures ? I have a picture that have been passing some colorspace computations

2019-03-18 12:55:09 -0500 asked a question How do I check average brightness from 2 pictures ?

How do I check average brightness from 2 pictures ? I have a picture that have been passing some colorspace computations

2019-02-03 17:34:07 -0500 received badge  Supporter (source)
2019-01-29 14:53:55 -0500 asked a question Makefile for c++ program with OpenCV

Makefile for c++ program with OpenCV I tried to compile my program in terminal, here's how I compile it : g++ $(pkg-con

2018-12-13 06:15:53 -0500 commented question Count color using calcHist, how exactly to read the histogram ?

| can you explain some more about it ? exactly count how many colors. (edit) yes, unique colors. is that possible wit

2018-12-13 06:15:05 -0500 commented question Count color using calcHist, how exactly to read the histogram ?

| can you explain some more about it ? exactly count how many colors.

2018-12-13 06:13:34 -0500 commented question Count color using calcHist, how exactly to read the histogram ?

| can you explain some more about it ? exactly count how many colors.

2018-12-13 06:11:28 -0500 marked best answer Extract only few seconds in the beginning of video file

I want to extract frames from a video. But only 2 seconds at the beginning of the video. I want to work with raw video as much as I can, that why I don't want to cut the original video and then process it.

Here's my code to extract frame. But this will extract all frame from the video :

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <string>
#include <sstream>

using namespace cv;
using namespace std;
int c = 0;
string int2str(int &);

int main(int argc, char **argv) {
    string s;

    VideoCapture cap("test_video.mp4"); 
    if (!cap.isOpened())  
    {
        cout << "Cannot open the video file" << endl;
        return -1;
    }

    double fps = cap.get(CV_CAP_PROP_FPS); 

    cout << "Frame per seconds : " << fps << endl;

    namedWindow("MyVideo", CV_WINDOW_NORMAL); 
    resizeWindow("MyVideo", 600, 600);
    while (1)
    {
        Mat frame;
        Mat Gray_frame;
        bool bSuccess = cap.read(frame); 

        if (!bSuccess) 
        {
            cout << "Cannot read the frame from video file" << endl;
            break;
        }
        s = int2str(c);
        //cout<<("%d\n",frame )<<endl;
        c++;
        imshow("MyVideo", frame); 
        imwrite("frame" + s + ".jpg", frame);
        if (waitKey(30) == 27) 
        {
            cout << "esc key is pressed by user" << endl;
            break;
        }
    }

    return 0;

}

string int2str(int &i) {
    string s;
    stringstream ss(s);
    ss << i;
    return ss.str();
}

Any advice ?

2018-12-13 06:06:14 -0500 edited question Count color using calcHist, how exactly to read the histogram ?

Count color using calcHist, how exactly to read the histogram ? Hi, I want to count colors in an image. I read many sugg