Ask Your Question

VeTaLio's profile - activity

2020-07-04 04:23:01 -0600 received badge  Notable Question (source)
2018-06-22 07:18:48 -0600 received badge  Good Question (source)
2018-04-01 15:24:22 -0600 received badge  Popular Question (source)
2018-01-18 18:52:50 -0600 received badge  Popular Question (source)
2017-11-22 07:45:59 -0600 received badge  Favorite Question (source)
2017-09-10 03:51:14 -0600 received badge  Famous Question (source)
2017-02-20 03:10:14 -0600 received badge  Notable Question (source)
2016-11-04 17:42:37 -0600 received badge  Famous Question (source)
2016-10-21 09:57:43 -0600 received badge  Popular Question (source)
2016-06-24 05:05:21 -0600 received badge  Notable Question (source)
2016-04-13 12:48:40 -0600 received badge  Popular Question (source)
2015-12-17 06:03:15 -0600 commented answer object detection in nonuniform illumination

@pklab yes,i have made this(almost yesterday tried) and result is always fully black image.

2015-12-17 02:43:08 -0600 commented answer object detection in nonuniform illumination

@pklab the result is black image. I'm doing something wrong?

2015-12-16 08:28:15 -0600 commented answer object detection in nonuniform illumination

@pklab hello again,the problem occurs on "// BUILD THE DESTINATION" part of code. my source type Cv_8uc4 and its pointless(in my case,because will not enter to this conditions,what can i do?).
Also this line: brightness += m(0); i change with Core.Add(mat,scalar,mat); ,is this ok? Thank you!

2015-12-14 09:15:52 -0600 commented answer How to make auto-adjustments(brightness and contrast) for image Android Opencv Image Correction

@pklab BTW i forgot to say,that you can paste your answer here http://stackoverflow.com/questions/33... (because i duplicated question at begging both - stackoverflow&&opencv.answers). Also ill mark as solution :)!

2015-12-13 04:57:56 -0600 commented answer How to remove black/shadows regions of colored Image via OpenCV

@pklab sure ill accept answer,but until now, i didn't finished yet. Thanks for the reply!(Also arrow up i put always for you :) ! ).

2015-12-11 06:54:16 -0600 commented answer How to remove black/shadows regions of colored Image via OpenCV

@pklab thank you so much! ill try to implement this(nonuniform illumination). Also i would like to know your opinion,about "Gamma correction",is that good choice to improve dark regions?

2015-12-09 06:32:17 -0600 commented answer How to remove black/shadows regions of colored Image via OpenCV

@pklab also,how you think,this histogram equalization for coloured images is good idea to improve light and contrast?

2015-12-09 04:55:26 -0600 commented answer How to remove black/shadows regions of colored Image via OpenCV

@pklab thanks you so much! So i tried your algorithm and i have strange result. My examples :
source Image -> result
So you can see,that dark regions remains "dark"(but with little bit improved light) and lighter regions are getting more brightness. Thanks!

2015-12-08 02:51:36 -0600 commented answer How to remove black/shadows regions of colored Image via OpenCV

@pklab yes,but when i tried to implement this in java,my result was -> fully black image :). The problem is,that function minMaxLoc(java version) on input,have parametr: 1) Mat; 2) second variant of method have two parametrs on input : Mat,Mat. And how to get minGray value?(Because its zero by default).

2015-12-07 03:30:47 -0600 commented answer How to remove black/shadows regions of colored Image via OpenCV

@pklab i tried and my image converting to full black. Whats wrong? any suggestions?

2015-12-07 02:33:30 -0600 commented answer How to remove black/shadows regions of colored Image via OpenCV

@pklab hi,thanks for the reply. Yes,i want to "remove (restore image) shadows"(that means,the black/shadows regions must be more brighter.

2015-12-04 13:23:42 -0600 asked a question How to remove black/shadows regions of colored Image via OpenCV

Hello guys.I want to remove black/shadows regions of coloured image and after this improve contrast and brightness.
So how can i achieve this one?
Can i use equalizeHist or AdaptiveTreshold and after that,convert back to Coloured Image ?
Or what technique i can use to achieve my goal?
Thanks!

2015-12-04 12:33:05 -0600 commented answer How to make auto-adjustments(brightness and contrast) for image Android Opencv Image Correction

@pklab i think that i will make new question for this one,also ill put here url:). Thanks!

2015-12-04 12:31:18 -0600 marked best answer How to make auto-adjustments(brightness and contrast) for image Android Opencv Image Correction

i'm using OpenCV for Android.
I would like to know,how to make image correction(auto adjustments of brightness/contrast) for image(bitmap) in android via OpenCV or that can be done by native ColorMatrixFilter from Android!??

I tried to google,but didn't found good tutorials/examples.
So how can i achieve my goal? Any ideas?
Thanks!

2015-12-04 12:00:36 -0600 commented answer How to make auto-adjustments(brightness and contrast) for image Android Opencv Image Correction

@pklab works now! Can you tell me please,how can i remove "black/shadows" on image and auto contrast? Maybe i need to use EqualizeHist Or something else? Tell me if i need to make new question.Thanks!!!

2015-11-16 14:07:01 -0600 commented answer How to make auto-adjustments(brightness and contrast) for image Android Opencv Image Correction

@pklab my source image looks like http://tinypic.com/view.php?pic=2pr7c... and result,after your algorithm is http://i65.tinypic.com/11jqi3p.png . Any advice ? Thanks!

2015-11-16 13:42:42 -0600 asked a question How to improve Edge Detection of Rectangular objects

Hello everyone. I'm using OpenCV to find biggest rectangular object(paper sheet A4).
My work flow:

  1. Apply filters(cvtColor/Canny/Blur)
  2. via method FindContours() fill List with contours
  3. loop List of contours(size)
  4. Via ApproxPolyDP() method,fill ApproxCurve
  5. If ApproxCurve.Cols() == 0 , then begin again recursively step 1 with another filters.

So all works,but no so good,as i except and i need some advanced tips.
I have two types of filters,that i apply on source image:

Imgproc.cvtColor(SourceImage,SourceImage, Imgproc.COLOR_BGR2GRAY);
Imgproc.GaussianBlur(SourceImage, gray, new org.opencv.core.Size(5, 5), 0);
Imgproc.Canny(gray,gray, 75, 200);

after that,if my approxCurves == 0 or object is to small,i apply another filters:

Imgproc.cvtColor(SourceImage,SourceImage,Imgproc.COLOR_RGB2GRAY);
Imgproc.Canny(SourceImage, SourceImage,50,50);
Imgproc.GaussianBlur(SourceImage,gray,new Org.Opencv.Core.Size(5,5),5);

And that's it. For some "cases" it helps,but frequently fails. How can i improve my detection?
Thanks!

2015-11-16 07:45:41 -0600 commented answer How to make auto-adjustments(brightness and contrast) for image Android Opencv Image Correction

@pklab so i've translated to java and problem is that i'm getting too much brightness and contrast. I will upload some example to show you.

2015-11-15 08:07:36 -0600 commented question How to Convert Mat to ArrayList<Mat> Opencv Android
2015-11-15 08:06:26 -0600 asked a question calcHist always fails Android Opencv

Hi, i'm try do use calcHist,but always getting this exception:

CvException [org.opencv.core.CvException: cv::Exception: /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/imgproc/src/histogram.cpp:1427: error: (-215) csz == 0 || csz == dims in function void cv::calcHist(cv::InputArrayOfArrays, const std::vector<int>&, cv::InputArray, cv::OutputArray, const std::vector<int>&, const std::vector<float>&, bool)

My source code looks like:

int histSize = 256;
Imgproc.cvtColor(source, gray, Imgproc.colorBgra2gray);
Mat hist = new Mat(); //grayscale histogram
MatOfFloat Range = new MatOfFloat(0f,256f); 
MatOfInt histMatsize = new MatOfInt(256);
bool Accumulate = false;
List<Mat> ListMat = new ArrayList<Mat>();
ListMat.Add(gray);
MatOfInt channels = new MatOfInt(1,0);
Imgproc.CalcHist(ListMat, channels,new Mat(), hist, histMatSize, Range, Accumulate);

So via this post, i tried to change some things:

  int histSize = 256;
    Imgproc.cvtColor(source, gray, Imgproc.colorBgra2gray);
    Mat hist = new Mat(); //grayscale histogram
    MatOfInt histMatSize = new MatOfInt(256, 256, 256);
    bool Accumulate = false;
    List<Mat> ListMat = new ArrayList<Mat>();
    ListMat.Add(gray);
    MatOfInt channels = new MatOfInt(1,0);
    MatOfFloat ranges = new MatOfFloat(0.0f,256.0f, 0.0f, 256.0f, 0.0f, 256.0f);
    Imgproc.CalcHist(ListMat, channels,new Mat(), hist, histMatSize, ranges, Accumulate);

And didn't helped,what can i do to resolve my problem? Thanks!!

2015-11-15 07:51:21 -0600 marked best answer Provided data element number (0) should be multiple of the Mat channels count (1) Android OpenCV

I'm trying to find 4 corners from rect object(paper sheet).

                Mat source = new Mat();

                Org.Opencv.Core.Point center;

               public GetCorners(Bitmap _sourceImg)
                {
                    Utils.BitmapToMat(_sourceImg, source);
                }
               //find corners
                public void FindCorners()
                {
                    center = new Org.Opencv.Core.Point(0, 0);
                    //Mat source = new Mat();

                    if (source == null)
                    {
                        Console.WriteLine("No IMG");
                        return;
                    }

                    Mat BlackWhite = new Mat();

                    Imgproc.CvtColor(source, BlackWhite, Imgproc. ColorBgr2gray);  //ColorBgra2gray, 4);

                    Imgproc.Blur(BlackWhite, BlackWhite, new Size(3, 3));

                    Imgproc.Canny(BlackWhite, BlackWhite, 100, 100, 3, true);

                    Mat Lines = new Mat();
                    int treshold = 70;
                    int minLinsize = 30;
                    int lineGap = 10;

                    Imgproc.HoughLinesP(BlackWhite, Lines, 1, Math.PI / 180, treshold, minLinsize, lineGap);

                    for (int i = 0; i < Lines.Cols(); i++)
                    {
                        double[] Vector = Lines.Get(0, i);
                        double[] Value = new double[4];

                        Value[0] = 0;
                        Value[1] = ((float) Vector[1] - Vector[3]) / (Vector[0] - Vector[2]) * -Vector[0] + Vector[1];
                        Value[2] = source.Cols();
                        Value[3] = ((float)Vector[1] - Vector[3]) / (Vector[0] - Vector[2]) * (source.Cols() - Vector[2]) + Vector[3];

                        Lines.Put(0, i, Value);
                    }


                    Console.WriteLine("##KQuantity {0} Finded##",Lines.Cols());
                    List<Org.Opencv.Core.Point> Corners = new List<Org.Opencv.Core.Point>();

                    for (int i = 0; i < Lines.Cols(); i++)
                    {
                        for (int j = 0 ; i < Lines.Cols(); j++)
                        {
                            Mat m1 = new Mat(),
                            m2 = new Mat();
                            double[] d1 = Lines.Get(0, i);
                            double[] d2 = Lines.Get(0, j);
                            m1.Put(0, j, d1);
                            m2.Put(0, j, d2);
                    try
                    {
                    //i'm getting exception here
                    Org.Opencv.Core.Point pt = ComputeInteresect(Lines.Get(0, i), Lines.Get(0, j)); //(m1, m2);

                        if (pt.X >= 0 && pt.Y >= 0)
                        {
                            Corners.Add(pt);
                            Console.WriteLine ("dobavleno {0} koordinat",Corners.Count);
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }     
                        }
                    }

and also i got a method that calculate intersects :

static Org.Opencv.Core.Point ComputeInteresect(double[] a, double[] b) //(Mat es,Mat es2)// 
                {
                    double x1 = a[0], y1 = a[1], x2 = a[2], y2 = a[3], x3 = b[0], y3 = b[1], x4 = b[2], y4 = b[3];
                    double denom = ((x1 - x2) * (y3 - y4)) - ((y1 - y2) * (x3 - x4));
                    Org.Opencv.Core.Point pt = new Org.Opencv.Core.Point();
                    if (denom != 0)
                    {

                        pt.X = ((x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2)
                            * (x3 * y4 - y3 * x4))
                            / denom;
                        pt.Y = ((x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2)
                            * (x3 * y4 - y3 * x4))
                            / denom;
                        return pt;
                    } 
                    else
                        return new Org.Opencv.Core.Point(-1, -1);
                }

and i don't understand why,but i'm getting this exception :


java.lang.UnsupportedOperationException: Provided data element number (0) should be multiple of the Mat channels count (1)


I found,that this problem occurs,when image is an RGB Format(and have 4 channels),but at first,i'm converting to gray(1channel), via this method:

Imgproc.CvtColor(source, BlackWhite, Imgproc. ColorBgr2gray);  //ColorBgra2gray, 4);

Any help will be appreciated,thanks!

2015-11-15 07:51:21 -0600 received badge  Scholar (source)
2015-11-15 07:41:23 -0600 commented question How to Convert Mat to ArrayList<Mat> Opencv Android

@berak okay,i will do it now. You can also post your answer and i will mark as solution(List.Add(Mat)). Thanks!

2015-11-15 07:22:40 -0600 commented question How to Convert Mat to ArrayList<Mat> Opencv Android

@berak i tried to do same thing as it showing on github example,but always getting this error ( on calcHist) : CvException [org.opencv.core.CvException: cv::Exception: /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/imgproc/src/histogram.cpp:1427: error: (-215) csz == 0 || csz == dims in function void cv::calcHist(cv::InputArrayOfArrays, const std::vector<int>&, cv::InputArray, cv::OutputArray, const std::vector<int>&, const std::vector<float>&, bool)

2015-11-15 07:18:38 -0600 commented question How to Convert Mat to ArrayList<Mat> Opencv Android

@berak lol, method add worked well. Thanks! But now i got another problems.
can you please help me translate to java this answer http://answers.opencv.org/question/75... THanks!