Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/OpenCV_ImagesSupport.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function convertToMat(image)
if (cd == 3) # color (RGB) image
for j = 1:Base.size(img,2) # index row first (Mat is row-major order)
for k =1:Base.size(img,1) # index column second
colorvec = tostdvec([float(img[k,j,1].i),float(img[k,j,2].i),float(img[k,j,3].i)])
colorvec = [float(img[k,j,1].i),float(img[k,j,2].i),float(img[k,j,3].i)]
pixset(mat, k-1, j-1, colorvec) # -1 to have 0-indexing per C++
end
end
Expand Down
15 changes: 8 additions & 7 deletions src/OpenCV_Mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ end

function pixset(img, row::Int, col::Int, value)
(row < 0 || col < 0 || row > rows(img) || col > cols(img)) ? throw(BoundsError()) : nothing
cppvec = tostdvec(value)
# Grayscale and binary images (value:: double)
if (cvtypeval(img) == CV_8UC1)
@cxx at_u(img, row, col, value);
Expand All @@ -194,19 +195,19 @@ function pixset(img, row::Int, col::Int, value)
@cxx at_d(img, row, col, value);
# RGB images (value:: std::vector<double>)
elseif (cvtypeval(img) == CV_8SC3)
@cxx at_vc(img, row, col, value);
@cxx at_vc(img, row, col, cppvec);
elseif (cvtypeval(img) == CV_8UC3)
@cxx at_v3b(img, row, col, value);
@cxx at_v3b(img, row, col, cppvec);
elseif (cvtypeval(img) == CV_16SC3)
@cxx at_v3s(img, row, col, value);
@cxx at_v3s(img, row, col, cppvec);
elseif (cvtypeval(img) == CV_16UC3)
@cxx at_v3us(img, row, col, value);
@cxx at_v3us(img, row, col, cppvec);
elseif (cvtypeval(img) == CV_32SC3)
@cxx at_v3i(img, row, col, value);
@cxx at_v3i(img, row, col, cppvec);
elseif (cvtypeval(img) == CV_32FC3)
@cxx at_v3f(img, row, col, value);
@cxx at_v3f(img, row, col, cppvec);
elseif (cvtypeval(img) == CV_64FC3)
@cxx at_v3d(img, row, col, value);
@cxx at_v3d(img, row, col, cppvec);
else throw(ArgumentError("Image format not recognized!"))
end
end
Expand Down