Recent

Author Topic: [lazarus-opencv] Help with histogram  (Read 916 times)

JuviaYamired

  • Newbie
  • Posts: 1
[lazarus-opencv] Help with histogram
« on: April 06, 2019, 11:11:47 pm »
Hello, im using opencv for lazarus from this repository https://github.com/t-edson/LazarusOpenCV.
I'm trying to calculate the histogram of an image but cant understand how to use this functions
This is what im trying to do but fails, if anyone have some examples in how to use histograms too would be really usefull.
Code: Pascal  [Select][+][-]
  1. procedure TForm1.MenuItem3Click(Sender: TObject);
  2. type
  3.   iArray = array of integer;
  4.   iMatrix = array of iArray;
  5.   pArray = ^iArray;
  6. var
  7.   Range: iArray;
  8.   Ranges: iMatrix;
  9.   pRanges: ^iMatrix;
  10.  
  11.   histSize: PInteger;
  12.   histogram: pCvHistogram;
  13.   bmp: TBitmap;
  14. begin
  15.   New(histSize);
  16.   histSize^:= 256;
  17.  
  18.   SetLength(Range, 2);
  19.   SetLength(Ranges, 1);
  20.   Range[0]:= 0;
  21.   Range[1]:= 256;
  22.   Ranges[0]:= Range;
  23.   pRanges:= @Ranges;
  24.  
  25.   histogram:= cvCreateHist(1, histSize, CV_HIST_ARRAY, pRanges);
  26.   cvCalcHist(pipImage, histogram);
  27. end;
  28.  

 

TinyPortal © 2005-2018