Ask Your Question

macpirkimas's profile - activity

2017-04-26 09:24:29 -0600 commented question Webcam access with OpenCV and Websockets

Yes, I am sorry for posting in wrong place just a thought maybe some one had experience with it and could do a quick code share.

2017-04-26 06:25:16 -0600 asked a question Webcam access with OpenCV and Websockets

I want to access client web camera in my server with HTML5 getUserMedia process video stream with OpenCV& python and return processed video to a client in real time.

As I understand I need client side (HTML5 getUserMedia) and server side (OpenCV), communicate them with WebSockets. From client send encode frames in base64 send them via WebSockets to OpenCV and process them, when how to send results back to client side?

I am looking for example for a while, can someone guide me in right direction how to do it? Thanks!

2017-04-21 16:58:04 -0600 asked a question Machine learning to recognize books covers

What the machine learning algorithm would be the most proper to recognize particular books by a book cover? I have used the histogram of oriented gradients (HOG) with the Support vector machine (SVM) but I am not happy with the results. Maybe there is a better algorithm for this task?

2017-02-28 07:55:31 -0600 received badge  Editor (source)
2017-02-28 03:07:11 -0600 asked a question Build blocks and isolate characters

I have been searching for an answer for a while to this question but cannot find anything useful.

I am trying to read machine readable zone with a camera. I need to extract characters one by one from machine readable zone and feed to OCR. I tried to threshold image, to find contours, extract characters one by one but while it is on live camera find contours miss some characters and I get results not as I expected.

While machine readable zone is known size, form, is there a proper method to build blocks for each character and extract them?

ADDED CODE

rect = []
blur = cv2.medianBlur(roi_gray,3) #roi_gray is aligned horizontally MRZ zone
thresh = cv2.adaptiveThreshold(blur,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,11,2)
_,contours, hierarchy = cv2.findContours(thresh.copy(),cv2.RETR_CCOMP,cv2.CHAIN_APPROX_SIMPLE)
contours = sorted(contours, key=cv2.contourArea, reverse = True)[:90]
minH = 20
minW = 20
for ctr in contours:
    if cv2.contourArea(ctr) < 1000:
        xyc,wh,a = cv2.minAreaRect(ctr)
        w,h = wh
        x,y = xyc
        if h >= minH or w >= minW:
            rect.append(cv2.boundingRect(cv2.approxPolyDP(ctr,3,True)))

rect is containing collected contours but problem is that after thresholding as example character N is splitting into two contours, or it was not found by findContours so letter is missing in finally output.

VIDEO

I have found video there seems author build blocks for each character but unfortunately author does not provide any additional information about method or code. Video link

2017-02-24 00:35:02 -0600 received badge  Enthusiast
2017-02-20 05:45:18 -0600 commented answer Random Trees in OpenCV with Python (load method missing)

Thank you for the answer.

2017-02-20 05:39:58 -0600 received badge  Scholar (source)
2017-02-19 09:41:05 -0600 asked a question Random Trees in OpenCV with Python (load method missing)

In OpenCV 3.2.0 with Python can't find load function to load pre-trained model, it's clearly explained in C++ StatModel::load<rtrees>(filename). How to load pre-trained model with Python?

import cv2

help(cv2.ml.RTrees_create())

....

 |  Methods inherited from Algorithm:
 |  
 |  clear(...)
 |      clear() -> None
 |  
 |  getDefaultName(...)
 |      getDefaultName() -> retval
 |  
 |  save(...)
 |      save(filename) -> None

load(...) missing?