Ask Your Question

Nertius's profile - activity

2020-10-22 17:33:34 -0600 received badge  Famous Question (source)
2016-06-14 01:48:06 -0600 received badge  Notable Question (source)
2016-01-07 01:44:18 -0600 received badge  Nice Question (source)
2015-06-19 10:45:09 -0600 received badge  Popular Question (source)
2014-03-06 09:20:41 -0600 received badge  Student (source)
2013-02-07 07:20:42 -0600 received badge  Editor (source)
2013-02-07 07:17:02 -0600 asked a question draw circle in cv::mat

Hi people,

I'm having a hard time drawing nice circle in a cv::Mat I actually managed to draw something, but it looks like a star than a circle, and i can't understand why.

Here's my code to generate it :

Mat qr(width, width, CV_8UC1);
finalMat = qr.clone();
circle(finalMat, Point(50,50), (9), Scalar(255), -1, 8);
std::vector<int> params;
params.push_back(CV_IMWRITE_JPEG_QUALITY);
params.push_back(quality);
imencode(".jpg", finalMat, outbuf, params);
cout << "Content-Type:image/"<<format<<"\r\n\r\n";
for(int i=0;i<outbuf.size();i++)
      cout<<outbuf[i];

Do you have any why it does this instead of a real nice and soft circle ? Is there anyway to draw a proper circle with openCV ?

2013-02-06 12:48:45 -0600 commented answer Display IplImage in webbrowsers

;)

Just here to say that i manage, with your precious help, to display the wanted qrcode in my webbrowser. So i guess we could just say, mission complete. It's actually pretty easy ... once you know how to do ;)

       cout &lt;&lt; "Content-Type:image/jpeg\r\n\r\n";
    std::vector&lt;uchar&gt;outbuf;
    std::vector&lt;int&gt; params;
    params.push_back(CV_IMWRITE_JPEG_QUALITY);
    params.push_back(100);
    imencode(".jpg", qrMat, outbuf, params);
    for(int i=0;i&lt;outbuf.size();i++)
        cout&lt;&lt;outbuf[i];

Here we are, thank's again mate, was nice learning from you ;)

2013-02-06 12:04:57 -0600 commented answer Display IplImage in webbrowsers

Hey, it's not actually my website lol, i was just writing random stuff and it turned out to be a real website ;)

2013-02-06 11:29:17 -0600 commented answer Display IplImage in webbrowsers

héhé, no problem, even though it was not usefull to my app, it was nice reading about something i don't know ;)

First solution wouldnt do. My goal is to send from a html script an url to encode in GET data. Then, i would like to use my cgi-bin c++ app to qr encode this url, and print it into the browser.

From the html script, it would look like it : <img src="http://www.*.com/cgi-bin/qrcode.cgi?url=http://www.yop.com" />

So the only solution possible is solution 2.

2013-02-06 11:15:47 -0600 commented answer Display IplImage in webbrowsers

Awesome !! thank you so much for this, i'll try to implement and understand it !!

2013-02-06 11:04:57 -0600 commented answer Display IplImage in webbrowsers

Thank you for your support. It's very nice of you ;)

I actually can't see the purpose of the socket in my app. Usually, i'm in php where everthing's easy ;) and once you have the "data" of the image as i do width outbuf, you can do a simple : echo 'data:image/jpeg;base64,' . base64_encode($data);

I can't understand why it can't be done here and why we must go through sockets.

I'm doing this app only for fun, and i can't thank you enough for your help since no one around me knows c++ or opencv ;)

2013-02-06 10:45:48 -0600 commented answer Display IplImage in webbrowsers

I will try to understand this.

You were assuming write actually. I'm indeed triyng to write a small website in c++, i just don't how to do it yet.

My application is very simple. It's encoding qrcode. I already manage to have an array with 0 and 1 representing the black pixels and the white pixels of the qrcode.

Then, i wanted to use opencv's function to transform this array into a jpeg image and i managed to do so with you help and the function imencode. And now that my image is stored into outbuf i want this image to be printed into the webbrowser (firefox for me).

I know nothing about socket, and i have to say that what i read seems really difficult to me. I still wonder i there's another way.

Anyway, all of this seems kind of hard since i ... (more)

2013-02-06 09:30:23 -0600 commented answer Display IplImage in webbrowsers

Thanks a lot for your answer, i was struggling for days. SO far i managed to make it work until imencode.

But after, i've never used such things in c++ :

sprintf(head,"--mjpegstream\r\nContent-Type: image/jpeg\r\nContent-Length: %lu\r\n\r\n",outlen); write(sock,head,strlen(head)); write(sock,(char*)(&outbuf[0]),outlen);

I'm not sure how to define and use head, outlen an sock ... could you please explain me ?

Thanks again, your help is very appreciated !!

2013-02-06 06:40:05 -0600 commented question Display IplImage in webbrowsers

Thank's for answering, but your trick won't do. The purpose of my program is very simple. The user will give me an array containing 0 and 1, and i will convert it in an image that can be displayed in web browsers. ;)

2013-02-06 03:10:44 -0600 asked a question Display IplImage in webbrowsers

Hi people,

I'm currently building a small personal project in c++ on a linux server and i am facing a problem i can't solve myself.

I would like to know if it was possible to display in a web browser an IplImage image.

I first thought i would be able to convert it in png and then encode it in base64 and finally display it with a simple cout<<

But i can't figure how to do so. So i would like to know if someone could guide me trough or if there is a simpler way of doing.

Many thanks for your time and help. Cheers to everyone ;)

PS: i precise that i'm not at all an expert in c++. I used to practice it a lot at school, but it's a long time ago now ;)