Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Barcode recognition, Sobel derivatives and image transformation problem!

First of all, I am developing a program for barcode reading.I use Sobel derivatives to obtain Gradient representation of image in x and y direction for barcode bars.It works very well in both directions(0 to 270 degree).

But unfortunately my sobel derivative barcode can not recognize another angle of image.I don't know how to explain it, but you can understand it by looking at the two different pictures I've added below.

Correctly recognized barcode bars,

image description

Can not detect from the same angle in reverse view, image description

Here is my code for sobel derivatives , I have added y direction gradient view to x direction using addweighted command.

//Sobel_variables sobel_variables; vector<sobel_variables> sobel_variables(1); sobel_variables[0].alpha = 1;

sobel_variables[0].beta = 0.9;

Sobel(gray_image, sobel_variables[0].Gradx, sobel_variables[0].ddepth, 1, 0, 3);
Sobel(gray_image, sobel_variables[0].Grady, sobel_variables[0].ddepth, 0, 1, 3);

subtract(sobel_variables[0].Gradx, sobel_variables[0].Grady, sobel_variables[0].Gradient);

convertScaleAbs(sobel_variables[0].Gradient, sobel_variables[0].Gradient);

subtract(sobel_variables[0].Grady, sobel_variables[0].Gradx, sobel_variables[0].Gradient1);

convertScaleAbs(sobel_variables[0].Gradient1, sobel_variables[0].Gradient1);

addWeighted(sobel_variables[0].Gradient, sobel_variables[0].alpha, sobel_variables[0].Gradient1, sobel_variables[0].beta, 0, sobel_variables[0].Out_Image);

//sobel_variables[0].Out_Image.

imshow("Sobel_operations", sobel_variables[0].Out_Image);
return sobel_variables[0].Out_Image;

It is really strange.Any help will be apreciated to solve this problem.

Barcode recognition, Sobel derivatives and image transformation problem!

First of all, I am developing a program for barcode reading.I use Sobel derivatives to obtain Gradient representation of image in x and y direction for barcode bars.It works very well in both directions(0 to 270 degree).

But unfortunately my sobel derivative barcode can not recognize another angle of image.I don't know how to explain it, but you can understand it by looking at the two different pictures I've added below.

Correctly recognized barcode bars,

image description

Can not detect from the same angle in reverse view, image description

Here is my code for sobel derivatives , I have added y direction gradient view to x direction using addweighted command.

//Sobel_variables sobel_variables; vector<sobel_variables>

vector<Sobel_variables> sobel_variables(1);
 sobel_variables[0].alpha = 1;

1;

sobel_variables[0].beta = 0.9;

Sobel(gray_image, sobel_variables[0].Gradx, sobel_variables[0].ddepth, 1, 0, 3);
Sobel(gray_image, sobel_variables[0].Grady, sobel_variables[0].ddepth, 0, 1, 3);

subtract(sobel_variables[0].Gradx, sobel_variables[0].Grady, sobel_variables[0].Gradient);

convertScaleAbs(sobel_variables[0].Gradient, sobel_variables[0].Gradient);

subtract(sobel_variables[0].Grady, sobel_variables[0].Gradx, sobel_variables[0].Gradient1);

convertScaleAbs(sobel_variables[0].Gradient1, sobel_variables[0].Gradient1);

addWeighted(sobel_variables[0].Gradient, sobel_variables[0].alpha, sobel_variables[0].Gradient1, sobel_variables[0].beta, 0, sobel_variables[0].Out_Image);

//sobel_variables[0].Out_Image.

imshow("Sobel_operations", sobel_variables[0].Out_Image);
return sobel_variables[0].Out_Image;

It is really strange.Any help will be apreciated to solve this problem.

Barcode recognition, Sobel derivatives and image transformation problem!

First of all, I am developing a program for barcode reading.I use Sobel derivatives to obtain Gradient representation of image in x and y direction for barcode bars.It works very well in both directions(0 to 270 degree).

But unfortunately my sobel Sobel derivative barcode representation can not recognize another angle of image.I don't know how to explain it, but you can understand it by looking at the two different pictures I've added below.

Correctly recognized barcode bars,

image description

Can not detect from the same angle in reverse view, image description

Here is my code for sobel derivatives , I have added y direction gradient view to x direction using addweighted command.

vector<Sobel_variables> sobel_variables(1);
sobel_variables[0].alpha = 1;

sobel_variables[0].beta = 0.9;

Sobel(gray_image, sobel_variables[0].Gradx, sobel_variables[0].ddepth, 1, 0, 3);
Sobel(gray_image, sobel_variables[0].Grady, sobel_variables[0].ddepth, 0, 1, 3);

subtract(sobel_variables[0].Gradx, sobel_variables[0].Grady, sobel_variables[0].Gradient);

convertScaleAbs(sobel_variables[0].Gradient, sobel_variables[0].Gradient);

subtract(sobel_variables[0].Grady, sobel_variables[0].Gradx, sobel_variables[0].Gradient1);

convertScaleAbs(sobel_variables[0].Gradient1, sobel_variables[0].Gradient1);

addWeighted(sobel_variables[0].Gradient, sobel_variables[0].alpha, sobel_variables[0].Gradient1, sobel_variables[0].beta, 0, sobel_variables[0].Out_Image);

//sobel_variables[0].Out_Image.

imshow("Sobel_operations", sobel_variables[0].Out_Image);
return sobel_variables[0].Out_Image;

It is really strange.Any help will be apreciated to solve this problem.

Barcode recognition, Sobel derivatives and image transformation problem!

First of all, I am developing a program for barcode reading.I use Sobel derivatives to obtain Gradient representation of image in x and y direction for barcode bars.It works very well in both directions(0 to 270 degree).

But unfortunately Sobel derivative representation can not recognize another angle of the image.I don't know how to explain it, but you can understand it by looking at the two different pictures I've added below.

Correctly recognized barcode bars,

image description

Can not detect from the same angle in reverse view, image description

Here is my code for sobel derivatives , I have added y direction gradient view to x direction using addweighted command.

vector<Sobel_variables> sobel_variables(1);
sobel_variables[0].alpha = 1;

sobel_variables[0].beta = 0.9;

Sobel(gray_image, sobel_variables[0].Gradx, sobel_variables[0].ddepth, 1, 0, 3);
Sobel(gray_image, sobel_variables[0].Grady, sobel_variables[0].ddepth, 0, 1, 3);

subtract(sobel_variables[0].Gradx, sobel_variables[0].Grady, sobel_variables[0].Gradient);

convertScaleAbs(sobel_variables[0].Gradient, sobel_variables[0].Gradient);

subtract(sobel_variables[0].Grady, sobel_variables[0].Gradx, sobel_variables[0].Gradient1);

convertScaleAbs(sobel_variables[0].Gradient1, sobel_variables[0].Gradient1);

addWeighted(sobel_variables[0].Gradient, sobel_variables[0].alpha, sobel_variables[0].Gradient1, sobel_variables[0].beta, 0, sobel_variables[0].Out_Image);

//sobel_variables[0].Out_Image.

imshow("Sobel_operations", sobel_variables[0].Out_Image);
return sobel_variables[0].Out_Image;

It is really strange.Any help will be apreciated to solve this problem.

Barcode recognition, Sobel derivatives and image transformation problem!

First of all, I am developing a program for barcode reading.I use Sobel derivatives to obtain Gradient representation of image in x and y direction for barcode bars.It works very well in both directions(0 to 270 degree).

But unfortunately Sobel derivative representation can not recognize another angle of the image.I don't know how to explain it, but you can understand it by looking at the two different pictures I've added below.

Correctly recognized barcode bars,

image description

Can not detect from the same angle in reverse view, image description

Here is my code for sobel derivatives , I have added y direction gradient view to x direction using addweighted command.

vector<Sobel_variables> sobel_variables(1);
sobel_variables[0].alpha = 1;

sobel_variables[0].beta = 0.9;

Sobel(gray_image, sobel_variables[0].Gradx, sobel_variables[0].ddepth, 1, 0, 3);
Sobel(gray_image, sobel_variables[0].Grady, sobel_variables[0].ddepth, 0, 1, 3);

subtract(sobel_variables[0].Gradx, sobel_variables[0].Grady, sobel_variables[0].Gradient);

convertScaleAbs(sobel_variables[0].Gradient, sobel_variables[0].Gradient);

subtract(sobel_variables[0].Grady, sobel_variables[0].Gradx, sobel_variables[0].Gradient1);

convertScaleAbs(sobel_variables[0].Gradient1, sobel_variables[0].Gradient1);

addWeighted(sobel_variables[0].Gradient, sobel_variables[0].alpha, sobel_variables[0].Gradient1, sobel_variables[0].beta, 0, sobel_variables[0].Out_Image);

//sobel_variables[0].Out_Image.

imshow("Sobel_operations", sobel_variables[0].Out_Image);
return sobel_variables[0].Out_Image;

It is really strange.Any help will be apreciated to solve this problem.