Ask Your Question

sabra's profile - activity

2020-10-21 09:05:02 -0600 received badge  Student (source)
2017-07-04 02:09:25 -0600 commented answer Opencv 3.0.0 build winder Windows 8 with Gstreamer1.0 support

@blacksailer & @afanasjev i did all things but in build step have error about find libs and gst/gst.h can you give me some advice?

2017-07-03 06:22:27 -0600 asked a question build opencv 2.4.9 with gstream

hi everybody

i want to compile opencv with gstreamer

i read

http://answers.opencv.org/question/65...

and i did just fallow steps:

Download pkg-config-lite-0.28-1_bin-win32

Add following system paths

C:\Program Files (x86)\pkg-config-lite-0.28-1\bin

C:\Gstreamer\1.0\x86_64\lib\gstreamer-1.0

C:\Gstreamer\1.0\x86_64\lib

Add Environment Variable

PKG_CONFIG_PATH C:\Gstreamer\1.0\x86_64\lib\pkgconfig

Edit opencv\sources\CMakeLists.txt ... OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (WIN32 OR UNIX AND NOT ANDROID) )

but gstreamer still is no

please please help me

i add below code to LBPH::train(InputArrayOfArrays _in_src, InputArray _in_labels, bool preserveData) after produced the mat lbp_image (in opencv source) static int uniform[256] = // for exactly 8 bits / neighbours ! {
0,1,2,3,4,58,5,6,7,58,58,58,8,58,9,10,11,58,58,58,58,58,58,58,12,58,58,58,13,58,14,15,16,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,17,58,58,58,58,58,58,58,18,58,58,58,19,58,20,21,22,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,23,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,24,58,58,58,58,58,58,58,25,58,58,58,26,58,27,28,29,30,58,31,58,58,58,32,58,58,58,58,58,58,58,33,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,34,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,35,36,37,58,38,58,58,58,39,58,58,58,58,58,58,58,40,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,41,42,43,58,44,58,58,58,45,58,58,58,58,58,58,58,46,47,48,58,49,58,58,58,50,51,52,58,53,54,55,56,57};

Mat out;
Mat lookup(1,256,CV_32S, uniform); // make a Mat from it
LUT(lbp_image,lookup,lbp_image);

then also the number of histogram bins from 256 to 59 like below :

   Mat p = spatial_histogram(
                lbp_image, /* lbp_image */
                static_cast<int>(59), /* number of possible patterns */
                _grid_x, /* grid size x */
                _grid_y, /* grid size y */
true);

but i got this error :

assertion failed : (lutcn == cn || lutcn == 1) && lut.total() == 256 && lut.isContinuous() && (src.depth() == CV_8U || src.depth() == CV_8S) in function LUT

i know that problem is in : src.depth() == CV_8U || src.depth() == CV_8S)

please help me in detail that what changes are need, im a begginer in opencv

i have a qt program that using opencv

i can cross compile qt programs and run on raspberry

but i ... (more)

2017-04-23 00:30:36 -0600 commented question change pixel value return false!

hsv[1]/255 <0.2 ? i this right for smoke?

2017-04-22 07:01:17 -0600 asked a question change pixel value return false!

i have a program that check values of pixels to be in range

but the result surprize me!

only just part of image affected and smoky area arnt in range!

please help me

#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/video/video.hpp>


using namespace std;
using namespace cv;

void colorDetect(Mat mFrame,int redThreshold, double saturationThreshold)
{
    Mat temp;
    GaussianBlur(mFrame, temp, Size(3, 3), 0);
    Mat img;
    cvtColor(temp,img,CV_BGR2HSV);


    for (int i = 0; i < temp.rows; i++) {
        for (int j = 0; j < temp.cols; j++) {


            Vec3b& hsv = img.at<Vec3b>(i, j);

            Vec3b& v = temp.at<Vec3b>(i, j);

                    if((abs(v[2]-v[1])<=20 && abs(v[0]-v[1])<=20 && abs(v[2]-v[0])<=20 && hsv[1]<=0.4)  ){
                        mFrame.at<uchar>(i, j) = 255;

                    }
                    else{

                        mFrame.at<uchar>(i, j) = 0;
                    }


        }
    }

    imshow("mframe",mFrame);
    cvWaitKey(0);
}

int main(){

    Mat frame=imread("D:/121.jpg",1);
    colorDetect(frame,150,0.12);


    return 1;
}
2017-04-21 23:33:04 -0600 commented question idea about difference bet moving red obj & fire

hsv is better or rgb or ycrcb? im using: colorDetect(RGB based)+svm.predict

if i add red moving obj to negative,true alarms reduced

@Tetragramm @StevenPuttemans

2017-04-18 07:05:11 -0600 asked a question idea about difference bet moving red obj & fire

the subject is clear friends, i can detect fire very good by svm, but when i add negative sample about moving red obj, again in the test step , a moving red object detected as fire!!

2017-04-17 05:46:24 -0600 commented answer denoise binary image by density c++

i dont know actualy ,this is part of an open source project,i adjusted it but its slow @LBerger

2017-04-17 00:07:38 -0600 commented answer denoise binary image by density c++

i edited post, your solution was good , but how about density? tnx for guide me

@LBerger

2017-04-16 03:51:49 -0600 asked a question denoise binary image by density c++

i have amethods like below that have good results:

void TargetExtractor::denoise(int ksize, int threshold)
{
    int r = (ksize - 1) / 2;
    if (r <= 0) {
        return;
    }

    Mat density;
    calcDensity(mMask, density, ksize);

    for (int i = r; i < mMask.rows - r; i++) {
        for (int j = r; j < mMask.cols - r; j++) {
            int count = density.at<int>(i, j);
            if (count < threshold) {
                mMask.at<uchar>(i, j) = 0;
            }
        }
    }
}

But its time is 120-140 ms!!! can you suggest me another methods?

edit 2: tnx to reply guys please notice that the:

in the code most time related to calcdensity:

/ this function is an alternative to the old one which is implemented with 'sum'
void calcDensity(const Mat& mask, Mat& density, int ksize)
{
    int r = (ksize - 1) / 2;
    if (r <= 0) {
        return;
    }

    density = Mat::zeros(mask.size(), CV_32SC1);

    int rowBound = density.rows - r, colBound = density.cols - r;

    Rect rect(0, 0, ksize, ksize);
    density.at<int>(r, r) = cvRound(sum(mask(rect))[0] / 255);

    for (int j = r + 1; j < colBound; j++) {
        int col1 = j - r - 1, col2 = j + r;
        int delta = 0;
        for (int k = 0; k < ksize; k++) {
            delta += mask.at<uchar>(k, col2) - mask.at<uchar>(k, col1);
        }
        density.at<int>(r, j) = density.at<int>(r, j - 1) + delta / 255;
    }

    for (int i = r + 1; i < rowBound; i++) {
        int row1 = i - r - 1, row2 = i + r;
        int delta = 0;
        for (int k = 0; k < ksize; k++) {
            delta += mask.at<uchar>(row2, k) - mask.at<uchar>(row1, k);
        }
        density.at<int>(i, r) = density.at<int>(i - 1, r) + delta / 255;
    }

    for (int i = r + 1; i < rowBound; i++) {
        for (int j = r + 1; j < colBound; j++) {
            int delta = (mask.at<uchar>(i + r, j + r) - mask.at<uchar>(i - r - 1, j + r) -
                mask.at<uchar>(i + r, j - r - 1) + mask.at<uchar>(i - r - 1, j - r - 1)) / 255;
            density.at<int>(i, j) = density.at<int>(i - 1, j) + density.at<int>(i, j - 1) -
                density.at<int>(i - 1, j - 1) + delta;
        }
    }
}
2017-04-16 03:47:32 -0600 answered a question best methods for fire detection

svm is better than colorspace methods!

@berak @StevenPuttemans

this is what i wanted

2017-04-08 23:33:07 -0600 answered a question Black screen Logictech webcam C110

check your camera with vlc,if vlc cant open it,its a problem with your camera change your camera, else put your code here

2017-04-08 23:29:02 -0600 commented question best methods for fire detection

i searched sir, its all about "methods" not "result of methods" @berak

2017-04-08 03:16:09 -0600 commented answer How to solve this error ?error: ..\..\..\..\opencv\modules\imgproc\src\color.cpp:3739: error: (-215) scn == 3 || scn == 4 in function cv::cvtColor

also check channel of image

2017-04-08 03:09:18 -0600 answered a question integrating opencv with visual studio 13

first add include file of opencv -- in my system: C:\opencv\build\include

then add lib directory -- in my system: C:\opencv\build\x86\vc11\lib --->note : im using vs2012

then add names of libs to input linker:

note: "im using opencv 2.4.9" what about u?

opencv_calib3d249d.lib opencv_contrib249d.lib opencv_core249d.lib opencv_features2d249d.lib opencv_flann249d.lib opencv_gpu249d.lib opencv_highgui249d.lib opencv_imgnd249d.lib opencv_imgproc249d.lib opencv_ml249d.lib opencv_nonfree249d.lib opencv_objdetect249d.lib opencv_ocl249d.lib opencv_photo249d.lib opencv_stasm249d.lib opencv_stitching249d.lib opencv_superres249d.lib opencv_ts249d.lib opencv_video249d.lib opencv_videostab249d.lib

if you are using v2013 you must add v12 of lib

for another example

if you are using v2012 you must add v11 of lib

2017-04-08 03:02:53 -0600 asked a question best methods for fire detection

best methods for fire detection using image processing? i saw svm,and color based (hsv or ycrcb) methods, i don't have 2000 negative and positive sample to train svm and see its result, so i hope someone guide me that this method is ok or not? note that im not a researcher,im just working on open source codes
best wishes

2017-03-14 03:14:42 -0600 commented answer accuracy of uniform lbp is scandal

how make dst uchar? what changes are need? sorry im inexperienced @berak

2017-03-14 02:48:11 -0600 commented answer accuracy of uniform lbp is scandal

so? what can i do? please @berak

2017-03-14 01:16:43 -0600 commented answer accuracy of uniform lbp is scandal

i cheked like below

        Mat lookup(1,256,CV_32S, uniform); // make a Mat from it
        bool x=lookup.isContinuous();
        int cnn=lookup.channels();
        int y=lookup.total();
        int z= lbp_image.depth();
            LUT(lbp_image,lookup,lbp_image);// =====> error appear here

        Mat p = spatial_histogram(
                lbp_image, /* lbp_image */
                static_cast<int>(59), /* number of possible patterns */
                _grid_x, /* grid size x */
                _grid_y, /* grid size y */
                true);

x--> true

cnn-->1

y-->256

z-->4

@berak

2017-03-14 00:59:30 -0600 commented answer accuracy of uniform lbp is scandal

@berak i did all but : assertion failed : (lutcn == cn || lutcn == 1) && lut.total() == 256 && lut.isContinuous() && (src.depth() == CV_8U || src.depth() == CV_8S) in function LUT

2017-03-14 00:47:25 -0600 received badge  Enthusiast
2017-03-13 06:18:05 -0600 commented answer accuracy of uniform lbp is scandal

tnx alot but in second link what is your mean?

 static_cast<int>(std::pow(2.0, static_cast<double>(_neighbors))),

this result is 2^8 so

should i set it to static_cast<int>(59) ?

2017-03-13 03:35:19 -0600 commented question accuracy of uniform lbp is scandal

@berak : i edited it,if you need more details, i must first sort my code :)

2017-03-13 00:58:24 -0600 asked a question accuracy of uniform lbp is scandal

hi, im using opencv func for uniform lbp (LUT ) and accuracy of recognition get worth but i read that this will not happen,what am i wrong?

read images

resize each image

lut(images,lookup table,images);

train images detection

2017-03-11 05:50:49 -0600 commented answer uniform lbp using lut Func.

@berak i changed my code to your suggestion,my trained model reduced from 6,7 Mb to 6,3 and accuracy is scandal!!!! why?