mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
cleanup code following https://stackoverflow.com/questions/45868943/convert-node-array-variable-lenght-to-a-const-float-to-call-opencv-calchist/45870887#45870887
This commit is contained in:
parent
47080c1895
commit
431f9015d8
@ -20,7 +20,6 @@ NAN_METHOD(Histogram::CalcHist) {
|
||||
Matrix* m0 = Nan::ObjectWrap::Unwrap<Matrix>(info[0]->ToObject());
|
||||
cv::Mat inputImage = m0->mat;
|
||||
|
||||
//int dims = 3;
|
||||
// Arg 1 is the channel
|
||||
Local<Array> nodeChannels = Local<Array>::Cast(info[1]->ToObject());
|
||||
const unsigned int dims = nodeChannels->Length();
|
||||
@ -29,8 +28,6 @@ NAN_METHOD(Histogram::CalcHist) {
|
||||
channels[i] = nodeChannels->Get(i)->IntegerValue();
|
||||
}
|
||||
|
||||
//int channels[] = {0, 1, 2};
|
||||
|
||||
// Arg 2 is histogram sizes in each dimension
|
||||
Local<Array> nodeHistSizes = Local<Array>::Cast(info[2]->ToObject());
|
||||
int histSize[dims];
|
||||
@ -39,7 +36,6 @@ NAN_METHOD(Histogram::CalcHist) {
|
||||
}
|
||||
|
||||
// Arg 3 is array of the histogram bin boundaries in each dimension
|
||||
|
||||
Local<Array> nodeRanges = Local<Array>::Cast(info[3]->ToObject());
|
||||
/// Set the ranges ( for B,G,R) )
|
||||
float histRanges[dims][2];
|
||||
@ -54,8 +50,6 @@ NAN_METHOD(Histogram::CalcHist) {
|
||||
ranges[i] = histRanges[i];
|
||||
}
|
||||
|
||||
//const float** histRanges1 = const_cast<const float**>(histRanges);
|
||||
|
||||
// Arg 4 is uniform flag
|
||||
bool uniform = info[4]->BooleanValue();
|
||||
|
||||
@ -65,13 +59,6 @@ NAN_METHOD(Histogram::CalcHist) {
|
||||
// Perform calcHist
|
||||
cv::calcHist(&inputImage, 1, channels, cv::Mat(), outputHist, dims, histSize, ranges, uniform);
|
||||
|
||||
// Wrap the output image
|
||||
/*Local<Object> outMatrixWrap = Nan::NewInstance(Nan::GetFunction(Nan::New(Matrix::constructor)).ToLocalChecked()).ToLocalChecked();
|
||||
Matrix *outMatrix = Nan::ObjectWrap::Unwrap<Matrix>(outMatrixWrap);
|
||||
outMatrix->mat = outputHist;
|
||||
|
||||
info.GetReturnValue().Set(outMatrixWrap);*/
|
||||
|
||||
v8::Local<v8::Array> arr = Nan::New<Array>(histSize[0]);
|
||||
|
||||
if(dims < 1 || dims > 3){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user