Ask Your Question

jjabaram's profile - activity

2020-04-28 16:00:57 -0600 received badge  Notable Question (source)
2019-08-20 11:12:02 -0600 received badge  Popular Question (source)
2017-10-16 07:22:57 -0600 received badge  Student (source)
2017-10-16 01:43:07 -0600 edited question Matching image position before comparing image

Matching image position before comparing image My goal is to make image 1 and image 2 in the same position before compar

2017-10-15 23:44:57 -0600 asked a question Matching image position before comparing image

Matching image position before comparing image My goal is to make image 1 and image 2 in the same position before compar

2017-09-26 20:03:22 -0600 marked best answer Mat::at <Double> give Unhandled exception
im = imread(image1, IMREAD_GRAYSCALE);
Mat PdivS = Mat(im.rows, im.cols, CV_32F);
double val1 = 0;

divide(P, S, PdivS);
minMaxLoc(PdivS, &min, &max);
double tempmax = max;

for (int x = 0; x < im.rows; x++)//To loop through all the pixels 
    {
        for (int y = 0; y < im.cols; y++)
        {
            val1 = PdivS.at<double>(x, y); //<<<Give Unhandled exception
            res = (val1 / tempmax) * 255;
            PdivS.at<double>(x, y) = res;
        }
    }

When I tried using float on val1 and Mat::at, it doesn't have a problem. but when I change to double it give me.

Unhandled exception at 0x00007FFE727695FC in lineconnect.exe: Microsoft C++ exception: cv::Exception at memory location 0x0000007BA83DB690.

what shoud i do ?

2017-09-26 02:54:34 -0600 commented answer Mat::at <Double> give Unhandled exception

Thank you for your answer. If I use it, is the result will same as i loop it ?

2017-09-26 02:50:36 -0600 commented answer Mat::at <Double> give Unhandled exception

Thank you for your answer. If I use it, is it the result will same as i loop it ?

2017-09-26 02:11:15 -0600 asked a question Mat::at <Double> give Unhandled exception

Mat::at <double> give Unhandled exception im = imread(image1, IMREAD_GRAYSCALE); Mat PdivS = Mat(im.rows, im.cols,

2017-09-15 01:27:29 -0600 edited question How to reconnect line that has blank or curvature in the middle

How to reconnect line that has blank or curvature in the middle How to reconnect between line that has a curvature or bl

2017-09-15 01:22:15 -0600 edited question How to reconnect line that has blank or curvature in the middle

How to reconnect line that has blank or curvature in the middle I'm searching how to reconnect between line that has a c

2017-09-15 01:22:12 -0600 edited question How to reconnect line that has blank or curvature in the middle

How to reconnect line that blank or have curvature in the middle I'm searching how to reconnect between line that has a

2017-09-15 01:21:32 -0600 asked a question How to reconnect line that has blank or curvature in the middle

How to reconnect line that blank or have curvature in the middle I'm searching how to reconnect between line that has a

2017-08-01 03:26:20 -0600 asked a question why need to convert from 8U to 32F when manipulate pixel?

I want to access and manipulate each image pixel but first, i need to understand the basic.

I try to understand the basic so I start looking from what is the difference between 8 bit, 16bit, 32 bit :

CV_8U - 8-bit unsigned integers (0..255)
CV_8S - 8-bit signed integers (-128..127) 
CV_16U - 16-bit unsigned integers (0..65535)
CV_16S - 16-bit signed integers (-32768..32767) 
CV_32S - 32-bit signed integers (-2147483648..2147483647) 
CV_32F - 32-bit floating-point numbers (-FLT_MAX..FLT_MAX, INF, NAN) //other sources say is (0.0 to 1.0)

when I try to manipulate image I need to convert to 32F that what I read from forum and articles.

My question is :

  1. what is the difference between 8, 16, 32 bit just range of number? what is a channel? what is scalar? what is vec3b?
  2. what is CV_32F ? is it range from 0.0 to 1.0 or more than that?(I try to show an image that I already convert to 32F and the image is just white (my understanding is the value that greater than 1 is white).)
  3. why we need to convert 8U to 32F when calculating pixel?
  4. what happens if manipulate image without convert to 32F?
  5. what is actually happen when converting 8U image to 32F and the other way around ? (from what I read when 32F convert to 8U is multiplied by 255. please explain more about the details )
  6. when calculating and get float and minus value as result, and convert to 8U what happened to float and minus value because 8U is unsigned integer from 0 to 255?

can someone please explain to me with your own way because I try to read the manual is hard to understand. Thank you very much for your help.

2017-07-04 00:56:03 -0600 received badge  Enthusiast
2017-07-03 19:13:25 -0600 commented question how to prove subtract value opencv

I'm sorry, I'm not careful enough. Thank you for your answer. actually, i really need help, and I want to consult with you @LBerger and @berak is it okay?

2017-07-03 05:25:46 -0600 commented answer what is normalize in opencv

Thank you for your answer @KjMag, actually I'm using greyscale image and without normalize all the screen is black, but when i normalize it, it become grey and when i print all the pixel value, the value only 85 there is no higher number or other number than 85, but there are couple white spot. that's why I'm confused right now.

2017-07-03 05:19:25 -0600 asked a question how to prove subtract value opencv

I need to prove pixle subtract value is right , I'm using this code :

subtract(image1,image2, min); //subtract image1 - image2

cout << endl << endl << "image 1 pixel : " << endl << endl;

for (int y = 0; y < 10; y++)//To loop through all the pixels 10x10
{
    for (int x = 0; x < 10; x++) //4 55
    {
            pix_val = image1.at<uchar>(x, y);
            cout << pix_val << " , ";
    }
    cout << endl;

}

cout << endl << endl << "image 2 pixel : " << endl << endl;

for (int x = 0; x < 10; x++)//To loop through all the pixels 10x10
{
    for (int y = 0; y < 10; y++)
    {
        pix_val = image2.at<uchar>(x, y);
        cout << pix_val << " , ";
    }
    cout << endl;

}


cout <<endl<<endl<< "min pixel : " << endl<<endl;

for (int x = 0; x < 10; x++)//To loop through all the pixels 10x10
{
    for (int y = 0; y < 10; y++)
    {
        pix_val = min.at<uchar>(x, y);
        cout << pix_val <<" , ";
    }
    cout << endl;

}

but the result is different

image description

but not all value match.

Please help me, i need to prove subtract value with number.

Thank you.

2017-07-03 03:55:26 -0600 asked a question what is normalize in opencv

I'm trying to understand what is normalize do. I have 2 images:

Image 1 :

image description

Image 2 :

image description

and then i try to divide it with

divide(image1, image2, div);

and i try to print it (10x10) :

image description

all value will become 1 or 0. and when show it, it will be like this :

image description

but when i normalize it :

normalize(div, nom, 0, 255, NORM_MINMAX, CV_8U);

it wil show like this :

image description

when i try print all the pixel value, the value is only 85, but in image there is white dot area.

can someone please explain to me what happen ?

Thank you.

2017-07-03 03:16:46 -0600 asked a question How to use Tan-1 in OpenCV

I want to calculate with this formula

tan-1(Image 1 / Image2)

how to implement it in OpenCV. Thank you.

2017-07-02 19:53:51 -0600 received badge  Supporter (source)
2017-06-30 02:59:01 -0600 asked a question How to Print Pixel Color Value C++

I have image with all value is 127(grey), and I want to try to pick one of coordinate and print pixel value, value must return 127.

printf("%d ", nom1.at<uchar>(Point(0, 0)));

but its give me an error . My purpose is to get each pixel color value and print it.

Thank you.

2017-06-29 21:05:12 -0600 commented answer Basic add and subtract on different size image

Thank you for your answer @KjMag. can you please explain to me what is different C1,C2,C3,C4. Thank you

2017-06-29 02:44:19 -0600 commented answer How to Use formula in c++ opencv

Thank you for your answer @LBerger, I'm new to OpenCV , can you please explain what is noArray(), CV_32F and CV_8U does? and can you also explain about normalize and the parameters thank you very much.

2017-06-29 01:53:01 -0600 asked a question How to Use formula in c++ opencv

I have 3 formula, (P and S is the same picture that taken with different method)

  1. P/S
  2. P/(P+S)
  3. |P-S|/|P+S|

Image P

image description

Image S

image description

and with one of these formula the result will become like this :

image description

how to implemet these formula in c++ ?

if i`m using

subtract(P, S, min); 
add(P, S, plus);`

is that same as P-S and P+S, and how to divide P with S ?

2017-06-28 21:37:33 -0600 asked a question Basic add and subtract on different size image

First i want to appologize.

I`m new to opencv. currently I try to practice with basic stuff. i try to add and subtract 2 image

First Image :

image description

Second Image :

image description

Third Image :

image description

when I try to add and subtract First and Second Image i got result :

Add

image description

Subtract

image description

My question Is :

can someone explain to me

1.why First Image + Second Image become brighter

2.why First Image - Second Image become dark

3.when i try to do add and subtract to FIrst Image + Third Image i got an error, why ? (I try search it and i found CV_32F ,CV_32FC1 what is that ?)

4.when i try to add and subtract same size image, but the image in greyscale i got an error too, why ?

Thank you.

2017-06-28 03:40:16 -0600 asked a question accessing row and col pixel array

image description

image description

for (int j = 0; j<image.rows; j++)
{
    for (int i = 0; i<image.cols; i++)
    { 
        if (image.at<uchar>(j, i) < 100) //change color less than 100
        {
            image.at<uchar>(j, i) = 255; // make it white
        }
    }
}

i want to change all the color < 100 to white, but only less than half of the image that change, is it something wrong with row and col calculation ?.

and how to select specific color in the image and change it to red.

Thank you.

2017-06-28 02:06:50 -0600 commented question OpenCV : Judge .bmp image

@KjMag first i wanna thank you for your help. second i`m sorry my mistake to click without try it first. actually after i try it, i dont know how to implement it in opencv. or maybe if you have full code to compare greyscale image it will help me alot.

2017-06-28 00:48:08 -0600 marked best answer OpenCV : Judge .bmp image

My boss told me to create program to judge an image. And the type of the image is to be .bpm, not .jpg or .png, and give a Number as an output.

The image is like this:

OK
image description

OK-1
image description

OK-2
image description

OK-3
image description

NO GOOD 1
image description

NO GOOD 2
image description

There are 6 Images, 4 images are good images, and 2 are bad images. The difference between OK-0, OK-1, OK-2, OK-2, OK-3 is the angle when image is taken.

OK
OK

NO GOOD 1
NO GOOD 1

if you see inside red line is more darker than outside. i want to get how much darker area in each images. with number or percentage as output. or maybe make OK image as default and compare to other images and get result how much it different.

File format is .bmp and i use C++, and OpenCV. Can someone please point me in the right direction: What function or method should i use?

Thank you. Your answer really means a lot to me.

2017-06-28 00:19:55 -0600 commented answer Histograms practice

Thanks it works.

2017-06-28 00:19:32 -0600 marked best answer Histograms practice

I try to practice with this code but, but it doesn`t read my image.

The Folder :

image description

argc just return 1.

is it because i don`t put the images in the right directory or the name of images that wrong ? i put the all the images same directory as project.

#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>

using namespace std;
using namespace cv;

/**
 * @function main
 */
int main( int argc, char** argv )
{
Mat src_base, hsv_base;
Mat src_test1, hsv_test1;
Mat src_test2, hsv_test2;
Mat hsv_half_down;

/// Load three images with different environment settings
if( argc < 4 )
{
    printf("** Error. Usage: ./compareHist_Demo <image_settings0> <image_settings1> <image_settings2>\n");
    return -1;
}

src_base = imread( argv[1], IMREAD_COLOR );
src_test1 = imread( argv[2], IMREAD_COLOR );
src_test2 = imread( argv[3], IMREAD_COLOR );

if(src_base.empty() || src_test1.empty() || src_test2.empty())
{
  cout << "Can't read one of the images" << endl;
  return -1;
}

/// Convert to HSV
cvtColor( src_base, hsv_base, COLOR_BGR2HSV );
cvtColor( src_test1, hsv_test1, COLOR_BGR2HSV );
cvtColor( src_test2, hsv_test2, COLOR_BGR2HSV );

hsv_half_down = hsv_base( Range( hsv_base.rows/2, hsv_base.rows - 1 ), Range( 0, hsv_base.cols - 1 ) );

/// Using 50 bins for hue and 60 for saturation
int h_bins = 50; int s_bins = 60;
int histSize[] = { h_bins, s_bins };

// hue varies from 0 to 179, saturation from 0 to 255
float h_ranges[] = { 0, 180 };
float s_ranges[] = { 0, 256 };

const float* ranges[] = { h_ranges, s_ranges };

// Use the o-th and 1-st channels
int channels[] = { 0, 1 };


/// Histograms
MatND hist_base;
MatND hist_half_down;
MatND hist_test1;
MatND hist_test2;

/// Calculate the histograms for the HSV images
calcHist( &hsv_base, 1, channels, Mat(), hist_base, 2, histSize, ranges, true, false );
normalize( hist_base, hist_base, 0, 1, NORM_MINMAX, -1, Mat() );

calcHist( &hsv_half_down, 1, channels, Mat(), hist_half_down, 2, histSize, ranges, true, false );
normalize( hist_half_down, hist_half_down, 0, 1, NORM_MINMAX, -1, Mat() );

calcHist( &hsv_test1, 1, channels, Mat(), hist_test1, 2, histSize, ranges, true, false );
normalize( hist_test1, hist_test1, 0, 1, NORM_MINMAX, -1, Mat() );

calcHist( &hsv_test2, 1, channels, Mat(), hist_test2, 2, histSize, ranges, true, false );
normalize( hist_test2, hist_test2, 0, 1, NORM_MINMAX, -1, Mat() );

/// Apply the histogram comparison methods
for( int i = 0; i < 4; i++ )
{
    int compare_method = i;
    double base_base = compareHist( hist_base, hist_base, compare_method );
    double base_half = compareHist( hist_base, hist_half_down, compare_method );
    double base_test1 = compareHist( hist_base, hist_test1, compare_method );
    double base_test2 = compareHist( hist_base, hist_test2, compare_method );

    printf( " Method [%d] Perfect, Base-Half, Base-Test(1), Base-Test(2) : %f, %f, %f, %f \n", i, base_base, base_half , base_test1, base_test2 );
}

printf( "Done \n" );

return 0;
}

Thank you.