1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-17 15:26:00 +08:00
Files
opencv_contrib/modules/julia/test/test_imgproc.jl
archit120 522a062cad Merge pull request #2547 from archit120:julia-phase1
Julia Bindings GSoC - phase1

* Julia Phase 1 first commit

* a few fixes to compile julia bindings on mac

* Readme changes

* Allow usage before installation and update README

* Add CxxWrap installation and fix Mac build bug

* CMake fixes and test refactoring

* add tests, fix trailing whitespace, disable array-vec conversion

* Fix trailing whiteline and warning

* Add module documentation and fix tests in CMake

* Change copyright block, CMake variable name

* copy => copy_if_different

* fix status dump and return lines

* Remove Julia_Found outside init.cmake

* change indentation

Co-authored-by: Vadim Pisarevsky <vadim.pisarevsky@gmail.com>
2020-06-17 07:33:37 +00:00

29 lines
659 B
Julia

# Create a random image
img = rand(UInt8 , 3, 500, 500)
# Test input as AbstractArray and cvtColor
img_gray = OpenCV.cvtColor(img, OpenCV.COLOR_RGB2GRAY)
@test size(img_gray, 1) == 1 && size(img_gray, 2) == size(img, 2) && size(img_gray, 3) == size(img, 3)
# Exception test
try
# This should throw an error
OpenCV.cvtColor(img_gray, OpenCV.COLOR_RGB2GRAY)
exit(1)
catch
# Error caught so we can continue
end
ve = view(img, :,200:300, 200:300)
# Auto-conversion from-to OpenCV types
ve_gray = OpenCV.cvtColor(ve, OpenCV.COLOR_RGB2GRAY)
# Shape check
@test size(ve_gray)[1] == 1 && size(img_gray)[1] == 1
print("imgproc test passed\n")