Ask Your Question

Cabezon667's profile - activity

2020-08-13 05:49:27 -0500 received badge  Notable Question (source)
2019-02-21 02:11:42 -0500 received badge  Notable Question (source)
2018-11-27 09:09:02 -0500 received badge  Popular Question (source)
2018-07-21 08:02:45 -0500 received badge  Popular Question (source)
2016-02-08 14:08:19 -0500 asked a question mean prediction in a image

Hi everyone.

I just want to ask what means mean prediction in a image, to improve the quality of its. I tried to found some information on internet, but I'm not sure of what to do.

From wikipedia, I understand the Mean-Prediction in a JPEG image is the value of 2 blocks + the variance of the block. The problem is i dont understand what I need to do for improve the quality of a JPEG image.

Is more a theorical question, but I really need help to understand what to do when a compression value affects the quality of a original image, and how to applie it. Is there a function on OPENCV that could help me?

Thank you.

http://stats.stackexchange.com/questi... This one is for the error.

2016-01-15 21:24:24 -0500 commented question Evaluation of 2 frames after encoding/decoding

Actually, I found the problem. My problem was when I read the image, i didnt put the '0' in the flag. Then, I tried to change everything to CV_8U and then i found the PSNR.

double psnr1;
Mat error1, error2, frame1,frame2;
frame1 = vframes[1];
frame2 = vframes[2];
absdiff(frame1,frame2,error1);
imwrite("error.jpeg",error1);
error2 = imread("error.jpeg",0);
error1.convertTo(error1, CV_8U);
error2.convertTo(error2, CV_8U);
psnr1 = PSNR(error1,error2);
cout << psnr1 << endl;
waitKey(0);

@Tetragramm thanks for your help, I really appreciate it. You are the best in this forum.

2016-01-15 20:56:10 -0500 asked a question Evaluation of 2 frames after encoding/decoding

Hi everyone,

Another question, I capture 2 frames and then I obtain the absolute error of them:

//// After capturing 2 frames
Mat frame1, frame2;
absdiff(frame1,frame2,error);

Everything ok at this point. But later I need to encoder/decoder the image and the evaluate that result with the first error (for obtain the PSNR for example) imwrite("error.jpeg",error); Mat error2 = imread("error.jpeg");

The problem here is error2 and error1 are different. I tried everything without success, but I cant understand why for example

Mat error3 = error2 - error1; //// Show an error of not equal size of the matrix.

I dont know what yo do. Did someone could help me? Thank you very much.

2016-01-15 19:51:05 -0500 commented answer Could OpenCV return a matrix for a function?

It was the hour! lol TY!

2016-01-15 18:04:59 -0500 received badge  Scholar (source)
2016-01-15 18:04:05 -0500 asked a question Could OpenCV return a matrix for a function?

Is a really simple question, but I need the answer.

Image this code

#include "opencv2/opencv.hpp"
#include <iostream>
#include <stdio.h>
#include <iomanip>  // for controlling float print precision
#include <sstream>  // string to number conversion

using namespace cv;
using namespace std;

int main()
{
//I load two diferents frames for a video
.....
Mat error ,m1,m2;
Mat m1 = frame1;
Mat m2 = frame2;
error = Mat matrix_error(m1,m2);
imshow("",error);
waitKey(0);
}

In functions.h

#ifndef FUNCTIONS_H_
#define FUNCTIONS_H_
#include "opencv2/opencv.hpp"
#include <iostream>
#include <stdio.h>
#include <iomanip>  // for controlling float print precision
#include <sstream>
using namespace cv;
using namespace std;
Mat matrix_error (const Mat& F1, const Mat& F2);
#endif /* FUNCTIONS_H_ */

functions.cpp

Mat matrix_error (const Mat& F1, const Mat& F2)
{
Mat s1;
absdiff(F1, F2, s1);
return s1;
}

The error ls Description "‘matrix_error’ was not declared in this scope". I know that im doing a really stupid mistake, but IDK where. If someone could help me I will appreciate.

Thanks.

2016-01-11 18:29:13 -0500 commented question Block-matching Algorithm in OpenCV?

I will give a look. Actually, now I made it using matchTemplate technique, thanks to you. So I suposse I'll close the question. Thanks again @Tetragramm

2016-01-10 18:12:21 -0500 commented question Block-matching Algorithm in OpenCV?

I know!, actually im working in that now and it seems nice. But anyway, I want to know what Im doing wrong in my project. Thanks again for the help.

2016-01-09 15:36:11 -0500 asked a question Block-matching Algorithm in OpenCV?

Hi everyone, I have a question if its possible to find a Block Matching Compensation Algorithm in OpenCV, or if exits a more easy method to implement it.

I tried to implement it, witout success.

#include "opencv2/opencv.hpp"
#include <iostream>
#include <stdio.h>
#include <iomanip>  // for controlling float print precision
#include <sstream>  // string to number conversion


using namespace cv;
using namespace std;
typedef Point_<int> Point2i;

int main()
{

Mat prueba, Ycrcb, I1,I2;
std::vector<cv::Mat> lum1;
std::vector<cv::Mat> lum2;
Mat lumI1,lumI2;
int blocksize = 16;
std::vector<cv::Mat> blocks[blocksize*blocksize];
Mat A = imread("/home/eduardo/Documents/PROJECT DIP/project/A.jpg");
Mat B = imread("/home/eduardo/Documents/PROJECT DIP/project/B.jpg");
int rows = A.rows;
int cols = A.cols;
cout << "rows = " << rows << endl;
cout << "cols = " << cols << endl;
cvtColor(A, A, CV_BGR2YCrCb);
cvtColor(B, B, CV_BGR2YCrCb);
split(A,lum1);
split(B,lum2);
lumI1 = lum1[0];
lumI2 = lum2[0];

//method to cut the images <---- IMPORTANT!
cv::Size macroblock(blocksize,blocksize);
std::vector<Mat> smallImages;

for (int y = 0; y < rows; y += macroblock.height)
{
    for (int x = 0; x < cols; x += macroblock.width)
{
    cv::Rect rect =  cv::Rect(x,y, macroblock.width, macroblock.height);
    smallImages.push_back(cv::Mat(lumI2, rect));
}
}

//arr[ 0*cols +0 ] = .... Para el futuro.

int bRows = rows/blocksize;
int bCols = cols/blocksize;
int x =bRows; int y = bCols;
cout << "bRows = " << bRows << endl;
cout << "bCols = " << bCols << endl;
int position = (x-1)*bCols + (y-1);
cout << "position = " << position << endl;

Everything ok until here, But when i try to implement the algorithm, the result are not good. In big words, Im using Rect() to evaluate one block with another in a range of [-search:search] and when i found the minimun error, I stored at a matrix x and y. Then, I plan to fullfill the blocks into a big image, but my result of X and Y doesnt make sense.

Mat block,B2;
int TE;
int E = 255*pow(blocksize,2);
Mat Err = Mat::zeros(bRows, bCols, CV_8U);
Mat xp = Mat::zeros(bRows, bCols, CV_8U);
Mat yp = Mat::zeros(bRows, bCols, CV_8U);
for (int r =1; r<=bRows;r++)
{
    //cout <<"begining = " << varE << endl;
for (int c =1; c<=bCols;c++)
{
    int rb=r*blocksize;
    int cb=c*blocksize;
    int search=blocksize*1.5;

    for(int dr = -search; dr<=search;dr++)
    {
        for(int dc = -search; dc<=search;dc++)
        {

            if(rb+dr-blocksize>0 && rb+dr<=rows && cb+dc-blocksize>0 && cb+dc<=cols)
            {
                int x1 = cb+dc-blocksize;
                int y1 = rb+dr-blocksize;
                block = lumI1( Rect(x1, y1,16,16) );
                position = (r-1)*bCols + (c-1);
                B2 = smallImages[position];
                TE= sum(cv::abs(block - B2))[0];
                if(TE<E)
                {
                    Err.at<int>(r,c) = TE;  //store the error
                    xp.at<int>(r,c) = x1;
                    yp.at<int>(r,c) = y1;
                    E=TE;
                }
            }
        }
    }
    E = 255*pow(blocksize,2);
}
}

I will appreciate any help. The algorithm runs but the results are not good. Thank you!

UPDATED: Template Matching function could help me in this situation?

2016-01-08 08:49:42 -0500 received badge  Enthusiast
2016-01-05 14:53:21 -0500 commented answer OpenCV installation into eclipse

Check the last part of the PDF, when you need to configure OpenCV in Eclipse. You can see the images to give you an idea. Remenber, the last part!

2016-01-05 09:07:49 -0500 received badge  Critic (source)
2016-01-05 08:36:42 -0500 answered a question OpenCV installation into eclipse

Hi:

Check this pdf: http://projects.i-ctm.eu/sites/defaul... is the way that I configure OpenCV in Eclipse.

Try to follow the last images, the last part. Tell me if its works in the end or not.

2016-01-05 08:25:15 -0500 commented question motion COMPENSATION between 2 frames?

I have frame1 and frame2, and Im trying to compensate the image and I Obtained the the 3rd frame. Is still unclear? I'm separating the 2 images into macroblocks and then I compare each macroblock, so I obtain compensate frame. Still unclear? I dont know if its allowed to put MatLab code to check my process.

2016-01-05 06:38:50 -0500 commented question motion COMPENSATION between 2 frames?

Hi, I updated my question.

2016-01-04 11:53:45 -0500 received badge  Editor (source)
2016-01-04 11:51:17 -0500 asked a question motion COMPENSATION between 2 frames?

Hello, my question is simple. I want to know how I could get a frame as the result of compensation between 2 images.

I understand functions as goodFeaturesToTrack() and cvCalcOpticalFlowPyrLK(), but my question is to OBTAIN the result of a compensated frame, not the estimation. I mean, to obtain the compensated frame between 2 frames.

I will appreciate any help, I'm newbie in OpenCV.

UPDATED:

To reply the question, a compensated frame is the result of the prediction between 2 frames, and is used to reduce the data for video processing. In the end, the substraction between 2 frames will give us a 'error frame' and this one will be encoder for transmission. The result between a frame and a compensated frame will give us a less error frame, that will improve the PSNR and reduce the bit-rate.

Im putting an example of my work in MatLab, that I want to implement in OpenCV.

image description

2015-12-30 07:56:00 -0500 commented answer Motion estimation between 2 frames

Let me give a check and I will give you an answer. Thanks for the reply, Happy new year!

2015-12-30 07:53:52 -0500 received badge  Supporter (source)
2015-12-30 06:15:11 -0500 asked a question Motion estimation between 2 frames

Hi everyone:

I want to try a Motion Estimation & Compensation between 2 frames. For that, I need to extract 2 consecutive frames, and then evaluate them.

My result have to be the image of the compensate frame with the first one. Any ideas? Because to implement the algorithm is really a pain.

I did it on MatLab, but I couldn't implemented on openCV. Thanks you!

This is my result using matlab:

image description

image description

UPDATE: I think I could interpolate 2 frames to obtain what I need. Someone could give me a hand please?