Ask Your Question

Flart's profile - activity

2018-06-03 17:25:22 -0500 received badge  Popular Question (source)
2018-03-07 04:14:21 -0500 received badge  Famous Question (source)
2017-06-26 18:13:19 -0500 received badge  Popular Question (source)
2017-05-12 21:49:26 -0500 received badge  Notable Question (source)
2017-01-11 04:58:34 -0500 received badge  Popular Question (source)
2015-06-23 04:30:31 -0500 received badge  Enthusiast
2015-06-22 06:18:56 -0500 commented question How to change the background of scanned document in opencv c++

Gray is not so bright, as you suggested at comment. Try CV_THRESH_OTSU or cv::threshold(imgH, imgH, 150, 255, CV_THRESH_TRUNC), it's enough for that kind of images.

2015-06-08 07:04:57 -0500 commented question Why gold version?

True, thank you. I have not seen it before. Usually "release" follows "release candidate".

2015-06-08 05:48:46 -0500 asked a question Why gold version?

Why OpenCV 3.0 gold? There are some "platinum" version coming soon?

2015-05-18 08:37:23 -0500 commented question save 16 bit images

May be there are some function in processing, what convert your image to 8UC3? Check docs to every function, what you are use, or use Image Watch Extensions for Visual Studio.

2014-12-09 14:00:47 -0500 marked best answer How to get the means OTSU threshold level in openCV?
cv::threshold(img1, img2, 0, 255, CV_THRESH_OTSU);

Zero (threshold level) is ommited. How to get value, that algorithm uses ?

2014-12-06 20:29:50 -0500 received badge  Nice Question (source)
2014-05-22 08:16:05 -0500 commented answer cvWaitKey is not generating key codes for naviagation keys
    int c = cv::waitKey(0);
    if (c == 2490368) y++; // up
    if (c == 2621440) y--;   // down
    if (c == 2424832) x--;   //  left
    if (c == 2555904)  x++;  // right

this is work for me. (dec)82 corresponds 'R'. May be that some locale issue? (which depend from system, too. Win, linux, etc.)

2014-05-21 09:01:01 -0500 commented answer cvWaitKey is not generating key codes for naviagation keys

That value depends from architecture of your system. For example, for me "up_key" equal (int) 2490368.

2014-03-12 07:44:50 -0500 asked a question animated gif support

Is there support read and write into animated gif in openCV?

2014-03-07 02:44:58 -0500 commented answer [URGENT]Is there any deblurring function in OPENCV-ANDROID?

Or really you want "de(spot)ing" your image?

2014-03-07 02:33:13 -0500 answered a question [URGENT]Is there any deblurring function in OPENCV-ANDROID?

If you blur image, you lose data. You can not restore it, so "deblurring" function don't exist (if I correctly understood this term)

You can try cv::normalize(), or addition contour to image for "improve" image

2014-03-05 09:00:43 -0500 asked a question Strange behavior short simple code with cv::Point and a references

That simple code leads 20 error in xutility file, and when I had commented temp = distance(p, pi), then solution successfully built. How to fix code; and why did errors appear?

P.S. static analyzer tells me about type pi : cv::Point_<int> pi, is that relates to the problem?

typedef vector<cv::Point> Points;

double distance (cv::Point& p1, cv::Point& p2) 
    return sqrt( pow( p1.x - p2.x,2) + pow( p1.y - p2.y,2));

double distance (cv::Point& p, Points& ps) 
     double d = numeric_limits<double>::max();
     double temp;

     for (auto pi: ps) 
          temp = distance(p, pi);
          if (temp < d) d = temp;
     return d;
2014-02-24 04:41:41 -0500 commented question Why does "Scalar" mean "Vector"

nice question, waiting big_karma_guys )

2014-02-12 01:31:38 -0500 commented question Pedestrian direction with cv::calcGlobalOrientation

I'm using HOG based pedestrian detector, but reduction false-positive leads increasing false-negative, so there are many skip pedestrians. So I can't determine _direction_ only by hog detector out_rectangles, because there are several pedectrians in one frame. And I using these out_rectangle with calcGlobalOrientation (see code above), but it don't work correctly. ----- updated my question.

2014-02-11 09:05:42 -0500 asked a question Pedestrian direction with cv::calcGlobalOrientation

I'm using HOG-based pedestrian detector, but reduction false-positive leads increasing false-negative, so there are many skip pedestrians. So I can't determine _direction_ only by hog detector out_rectangles, because there are several pedectrians in one frame.

So, I'm trying detect moving direction of found pedestrian by different way. One of a way is using motion gradient ( these out_rectangle to calcGlobalOrientation (see code below)), but I have unacceptably wrong result. I don't understand, why it are not handled correctly (upperbody doesn't have some changing area).

image description image description image description

// ... HOG-detector
Rect r_hog // result of HOG

cvtColor(frame, frame, CV_BGR2GRAY );
cv::absdiff(frame, preframe, diff);
cv::threshold(diff,diff,30,255, THRESH_BINARY);

cv::morphologyEx( diff, diff, cv::MORPH_CLOSE, cv::Mat( 5, 5, CV_8UC1 ) );
cv::morphologyEx( diff, diff, cv::MORPH_OPEN,   cv::Mat( 5, 5, CV_8UC1 ), cv::Point( -1, -1 ), 1, cv::BORDER_CONSTANT, cv::Scalar( 0 ) );

Size imageSize = diff.size();
Mat m_motionHistoryImage( imageSize, CV_32FC1,0.0 );
Mat m_segmask( imageSize, CV_32FC1 );
Mat mask ( imageSize, CV_8UC1 );
Mat orientation( imageSize, CV_32FC1 );

double cycleTime = 0.04;
double m_maxMotionGradient( 1.5 * cycleTime );
double m_minMotionGradient = m_maxMotionGradient/10;
double m_motionHistoryDuration(7 * cycleTime ) ;
double time=clock();

double timestamp = (time - startTime) / CLOCKS_PER_SEC/1000.0;
const double min_conrour_area = 200;

cv::updateMotionHistory( diff, m_motionHistoryImage, timestamp, m_motionHistoryDuration );   
calcMotionGradient( m_motionHistoryImage, mask, orientation, m_minMotionGradient, m_maxMotionGradient, 3 );

Rect r_without_legs = Rect(r_hog.x,r_hog.y, r_hog.width, r_hog.height/2);

double angle = calcGlobalOrientation( orientation(r_without_legs), mask(r_without_legs), m_motionHistoryImage(r_without_legs), timestamp, m_motionHistoryDuration);
angle = 360 - angle;

// draw angle
2014-02-06 01:27:29 -0500 received badge  Critic (source)
2014-02-05 03:32:14 -0500 commented answer puttext with black background

Thank you, I have missed that cv::getTextSize function :)

2014-02-05 01:51:16 -0500 asked a question puttext with black background

I want to write value on picture using puttext with black background. Code:

rectangle(frame, Rect(
     Point(50,50) + Point(0,-height), 
     Point(50,50) + Point(width,0)), 
putText(frame, Tostr(value), Point(50,50),1,1,Scalar(255,255,255),2);

But change of capacity value leads change of required width. How this width is determined, or did I miss some params of putText, which resolve my issue?

2014-01-17 09:25:22 -0500 commented answer how to detect people from the back

If chinayin _really_ beginner then he can start with my sketch, otherwise you are right, of course. Thank you for encouraging :)

2014-01-17 08:56:49 -0500 commented answer DefaultPeopleDetector: true pedestrian height

sorry, "true height" -- it is man's height at the picture by pixels. I forgot about IRL world and what "true height" is it by meters :-)

I notice, then I increase HeightPedestrian from real 250 pixels (measured by A Ruler For Windows from my video, which on screen thanks to cv::imshow) to 350 -- quality of detector increase. So I propose that in resizeRatio term actually not 128.0, but lower. Are you sure what all pedestrians were resized towards a 64x128 window from top to heel, without sky and ground on top and bottom of image?

2014-01-17 08:28:44 -0500 answered a question how to detect people from the back

Put your camera at level of heads (when people sit), consider part of images (video) above heads, and then use algorithm, base on frame difference.

When every one is sit -- where is no change in area above heads, when someone stand up -- he create big difference, that difference is your classifier (everyone sit / someone stand up)

2014-01-17 08:10:51 -0500 edited question DefaultPeopleDetector: true pedestrian height

HOGDescriptor::getDefaultPeopleDetector() classifier was trained using training images of 64*128 size, but what real height pedectrians at those train data?

Performance is important, and I approximately know height of my pedestrians -- so I using HOGDescriptor::detect() (not detectMultiScale()).

Firstly I resize my target area to detector resolution (coefficient of resizing equal to ratio between "detector height pedectrian" and "my data height pedectrian"), and then perform detect function.


double HeightPedestrian = 250.0;
double resizeRatio = 128.0 / HeightPedestrian;
resize(frame(RectWindow), frame_for_HOG, Size(), resizeRatio, resizeRatio);
HOGDescriptor hog;
hog.detect(frame_for_HOG, foundPoints, 0, Size(8,8), Size(32,32));
2014-01-17 06:31:04 -0500 commented answer average of some frames

scaling: sc1 = image * 0.5;

scaling: sc2 = image2 * 0.5;

plus: sc1 + sc2.

In total: (image * 0.5) + (image2 * 0.5)

In total: (scaling) plus (scaling).