Ask Your Question

Jack Chung's profile - activity

2019-05-10 14:34:33 -0500 received badge  Popular Question (source)
2017-01-25 01:57:20 -0500 received badge  Popular Question (source)
2016-01-12 11:26:06 -0500 received badge  Nice Question (source)
2015-08-12 08:04:15 -0500 received badge  Famous Question (source)
2015-01-05 09:01:26 -0500 received badge  Notable Question (source)
2014-08-14 12:46:08 -0500 received badge  Popular Question (source)
2014-05-21 04:43:03 -0500 received badge  Famous Question (source)
2014-01-25 16:23:18 -0500 received badge  Notable Question (source)
2013-11-21 00:39:34 -0500 received badge  Popular Question (source)
2013-10-16 09:08:56 -0500 commented answer Error OpenCV with Windows Application - Urgent Please

Well I have to use Windows Application because I want to do a GUI, that will choose what image I will load with OpenCV. Then I will need to use WinMain right?

Could you explain those parameters, please? I didn't understand them.

2013-10-16 08:58:40 -0500 asked a question How to do OpenCV in Windows Application?

Hello Guys,

I was using the OpenCV in Console Application and it was working fine, now I have to use Windows Application because I am doing a GUI to work with OpenCV.

How can I do OpenCV work in a Windows Application or How can I do GUI program in a Console Application?

I would appreciate it if someone could help me to solve that.

Thank you

2013-10-16 08:55:39 -0500 commented answer Error OpenCV with Windows Application - Urgent Please

How can I change the application type to SUBSYSTEM:CONSOLE? I am using Visual Studio.

Thanks for the fast answer

2013-10-16 08:34:30 -0500 asked a question Error OpenCV with Windows Application - Urgent Please

Hello Guys,

I was using the OpenCV in Console Application and it was working fine, now I have to use Windows Application because I am doing a GUI to work with OpenCV, but it is showing an error.

Please guys it is urgent, I would appreciate it if someone could help me to solve that.

Thank you

2013-10-13 13:19:57 -0500 asked a question User interface

Hello guys,

I would like to know how to do an user interface. It is simple, I would like to create a window that I can choose what Image I want to load in my cvLoadImage, with buttons "OK" And "Cancel" to confirm or not the image to load.

OpenCV has functions to do that or should I do with language C? Can someone give me an example please?

I would apreciate it if someone could help me to do that.

Thank you.

2013-08-16 07:00:59 -0500 received badge  Scholar (source)
2013-08-15 16:43:23 -0500 commented question How can I write pixel value in matrices?

The reason to use the old C is because I don't know how to use c++. Well, I tried to use what you said but it still not working, it is showing weird numbers in the console instead of 0 and 1 from the binary image.

2013-08-15 10:03:21 -0500 asked a question How can I write pixel value in matrices?

Hello,

How can I write a value in a matrice?

I already created a matrice, read a binary image and get the pixel value, now I would like to write the pixel value in the matrice.

I would appreciate it if someone could help me to set the pixel value in the matrice.

The code that I read a binary image and try to write the pixel value in the matrice is:

#include <opencv\cv.h>
#include <opencv\highgui.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
    uchar binario, valor;

    if(fp == NULL){
        printf("\nNão encontrei arquivo\n");
        exit(EXIT_FAILURE);
    }

    CvMat* polar = cvCreateMat(20, 172, CV_8UC1);

    cvNamedWindow( "original", CV_WINDOW_AUTOSIZE );
    cvNamedWindow( "new", CV_WINDOW_AUTOSIZE );

    IplImage* src = cvLoadImage("Koala.jpg", CV_LOAD_IMAGE_GRAYSCALE);
    cvShowImage("original", src);

    CvSize size = cvSize(40, 40); 
    IplImage* resize = cvCreateImage(size, src->depth, src->nChannels); 

    cvResize(src, resize, CV_INTER_LINEAR);

    IplImage* img_binario = cvCreateImage(cvGetSize(resize), IPL_DEPTH_8U, 1);
    cvThreshold(resize, img_binario, 100, 255, CV_THRESH_BINARY);

    for(int i = 0; i < 20; i++){
//*((uchar*)CV_MAT_ELEM_PTR(*polar, i, 1)) = ((uchar *)(img_binario->imageData + i*img_binario->widthStep))[20];

      cvSet2D(polar, i, 1, ((uchar *)(img_binario->imageData + i*img_binario->widthStep))[20]);
    }

    printf("Valor: %i", polar);

    cvShowImage("new", img_binario);

    cvWaitKey(0);
    return 0;
}

Thank you.

2013-08-13 09:56:20 -0500 asked a question How to send value with serial port (C Language)

Hello guys,

I am doing a project where I get the pixel value from a binary image (black and white - 0 and 255). Now I need to get this pixel value and send it with serial port, where a xBee is connected, but I don't know how can I do that.

I would appreciate it if someone could help me to send the pixel value to the xBee with serial port.

My code to get the pixel value from a binary image is:

#include <opencv\cv.h>
#include <opencv\highgui.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
    uchar binario, valor;

    FILE *fp;
    fp = fopen("Pixel.txt", "w");

    if(fp == NULL){
        printf("\nNão encontrei arquivo\n");
        exit(EXIT_FAILURE);
    }

    cvNamedWindow( "original", CV_WINDOW_AUTOSIZE );
    cvNamedWindow( "new", CV_WINDOW_AUTOSIZE );

    IplImage* src = cvLoadImage("Koala.jpg", CV_LOAD_IMAGE_GRAYSCALE);
    cvShowImage("original", src);

    CvSize size = cvSize(100, 100); 
    IplImage* resize = cvCreateImage(size, src->depth, src->nChannels); 

    cvResize(src, resize, CV_INTER_LINEAR);

    IplImage* img_binario = cvCreateImage(cvGetSize(resize), IPL_DEPTH_8U, 1);
    cvThreshold(resize, img_binario, 100, 255, CV_THRESH_BINARY);

    for(int i = 0; i < img_binario->height; i++){
        for(int j = 0; j < img_binario->width; j++){
            binario = ((uchar *)(img_binario->imageData + i*img_binario->widthStep))[j];

            if(binario == 255)
                valor = 1;
            else
                valor = 0;
            fprintf(fp, "Valor = %i\n", valor);
        }
    }

    fclose(fp);

    cvShowImage("new", img_binario);

    cvWaitKey(0);
    return 0;
}

Thank you.

2013-05-14 12:08:18 -0500 commented question How to get pixel value from a video file

Thank you very much, I made the mistake closing the fp inside the loop, that's why it was not working.

When I removed it, the code worked perfectly and gave to me the pixels from the video.

2013-05-14 08:52:29 -0500 commented question How to get pixel value from a video file

No it does not work....I dont know why, it just give pixel value (0, 0, 0) and just one time, I need to the whole video.

2013-05-14 08:26:43 -0500 asked a question How to get pixel value from a video file

Hello guys,

I would like to get the pixel value from a video file, I already got the pixel value from an image and now I need to get from a video.

The code that I have doesn't work, it show in the text file only the pixel B=0, G=0, R=0 and just one image (400 line - 20 x 20 size), I need the pixel value from the whole video. I would appreciate it if someone could help me with that issue.

Here is my code for load a video, resize it and try to get the pixel value from resized video:

#include <opencv\cv.h>
#include <opencv\highgui.h>
#include <stdio.h>
#include <stdlib.h>

int main( int argc) {
    CvCapture* capture =  cvCreateFileCapture( "POV_112LEDs.avi" );
    IplImage* frame;

    uchar b, g, r;

    FILE *fp;
    fp = fopen("Matriz.txt", "w");

    if(fp == NULL){
        printf("\nNão encontrei arquivo\n");
        exit(EXIT_FAILURE);
    }

    char c;
    cvNamedWindow( "original", CV_WINDOW_AUTOSIZE );
    cvNamedWindow( "nova", CV_WINDOW_AUTOSIZE );

    while(1) {
        frame = cvQueryFrame( capture ); 

        if( !frame ) break;
        cvShowImage( "original", frame );

        CvSize size = cvSize(20, 20);
        IplImage* tmpsize = cvCreateImage(size, frame->depth, frame->nChannels);
        cvResize(frame, tmpsize, CV_INTER_LINEAR);

        for(int i = 0; i < tmpsize->height; i++){
            for(int j = 0; j < tmpsize->width; j++){
                b = ((uchar *)(tmpsize->imageData + i*tmpsize->widthStep))[j*tmpsize->nChannels + 0]; // b
                g = ((uchar *)(tmpsize->imageData + i*tmpsize->widthStep))[j*tmpsize->nChannels + 1]; // g
                r = ((uchar *)(tmpsize->imageData + i*tmpsize->widthStep))[j*tmpsize->nChannels + 2]; // r

                fprintf(fp, "B=%i, G=%i, R=%i\n", b, g, r);
            }
        }

        fprintf(fp, "------NEXT FRAME------");
        fclose(fp);

        cvShowImage("nova", tmpsize);

        c = cvWaitKey(33);
        if( c == 27 ) break;
    }

    cvReleaseCapture( &capture );
    cvDestroyWindow( "original" );
    cvDestroyWindow( "nova" );
}

Thanks, Regards, Jack.

2013-05-06 12:57:52 -0500 received badge  Student (source)
2013-05-06 12:47:35 -0500 commented answer How to get pixel's value from a picture?

Well, I am using the C interface because I don't know how to use the C++ interface. I will try to use that macro.

Thanks, Jack.

2013-05-06 12:16:54 -0500 received badge  Editor (source)
2013-05-06 11:53:39 -0500 asked a question How to get pixel's value from a picture?

Hi guys,

I intend to get the pixel value from a picture, but I don't know how to do that, can someone help me please?

I have already loaded and resized an image, now I would like to get the pixel value from the new image and print it, probably I will need to use Matrices, but I don't know how. I would like to get the RGB pixel value and differentiate it in a matrix for each color ( Red, Green and Blue).

I would appreciate it if someone could help me with a sample code.

My code to load and resize the image is that:

#include <opencv\cv.h>
#include <opencv\highgui.h>

int main()
{
    cvNamedWindow( "original", CV_WINDOW_AUTOSIZE );
    cvNamedWindow( "new", CV_WINDOW_AUTOSIZE );

    IplImage* img = cvLoadImage("Koala.jpg");
    cvShowImage("original:",img);

    CvSize size = cvSize(800, 600); 
    IplImage* tmpsize=cvCreateImage(size, img->depth, img->nChannels); 

    cvResize(img,tmpsize,CV_INTER_LINEAR);
    cvShowImage("new",tmpsize);

    cvWaitKey(0);
    return 0;
}

Thank you, Jack.

2013-03-27 11:53:00 -0500 commented question How to decrease and interpolate an image/video

I intend to do a project in my university, and the project is a POV Display: http://www.youtube.com/watch?v=QAGnpKz7zvY

I will do with a 32 LED RGB, and to send any image/video i will need to decrease the image, but decreasing it, probably it will get a bad quality to see and understand something, tha's why I need to interpolate too, so I think it need to decrease the size and interpolate to get some quality.

It's difficult to explain it, did you understand something that I said?

2013-03-26 09:39:36 -0500 asked a question How to decrease and interpolate an image/video

Hello,

How can I decrease one image/video and interpolate it?

There is any library?

Thanks, Regards.

2013-03-26 09:35:10 -0500 received badge  Supporter (source)
2013-03-26 09:32:21 -0500 received badge  Critic (source)
2013-03-25 07:25:42 -0500 asked a question Interpolate / polarize Images in OpenCV

Hello,

I would appreciate it if someone could inform me if I can process images with OpenCV.

I want to give 1 video as archive and I need to decrease the screen, but it probably will get bad pixels and without focus, then I need to interpolate/polarize the image, can I do that with OpenCV?

Thank you. Regards, Jack.