Skip to content

Commit

Permalink
Merge pull request archit120#2 from archit120/gsoc-phase2
Browse files Browse the repository at this point in the history
Gsoc phase2
  • Loading branch information
archit120 authored Jul 24, 2020
2 parents 967d62f + 2f03a88 commit c9730c5
Show file tree
Hide file tree
Showing 94 changed files with 15,035 additions and 17,687 deletions.
2,552 changes: 2,552 additions & 0 deletions dumpt.txt

Large diffs are not rendered by default.

23 changes: 21 additions & 2 deletions src2/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,29 @@
## General
- fix classname for classes inside a namespace other than cv
- fix duplicate functions
- rename function names from classname_functionname to functionname (needed for intheritance)
- UMat wrapper
- Refactor parsing code


remove feature2d and term criteria duplicates
consider a different internal module
fix detectmultiscale and related function names
fix conversions for pseudo-constants
fix size type on julia side
change image to inputarray with abstractarray
ptr<cobj>
depracated
handle class names for nested namespaces
uchar - UInt8

1.f - 1.0f

empty constructors fix
bools - CxxBools
setfield - setfield!



use ref types in julia for pass by reference

make types mutable
fix pass by reference on both cxx and jl side
1,942 changes: 1,874 additions & 68 deletions src2/autogen_cpp/cv_core.cpp

Large diffs are not rendered by default.

36 changes: 32 additions & 4 deletions src2/autogen_cpp/jlcv2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,37 @@
#include "jlcxx/array.hpp"
#include "jlcxx/tuple.hpp"

#include <opencv2/core.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/core/ocl.hpp>


#include <opencv2/opencv.hpp>
#include <opencv2/core/bindings_utils.hpp>


#include <opencv2/opencv_modules.hpp>
#include <type_traits>

#include <opencv2/core/ocl.hpp>

using namespace cv;
using namespace std;
using namespace jlcxx;

#ifdef HAVE_OPENCV_HIGHGUI
#include <opencv2/highgui.hpp>
#endif

#ifdef HAVE_OPENCV_IMGPROC
#include <opencv2/imgproc.hpp>
#endif

#ifdef HAVE_OPENCV_VIDEOIO
#include <opencv2/videoio.hpp>
#endif

#ifdef HAVE_OPENCV_FEATURES2D
#include <opencv2/features2d.hpp>
typedef SimpleBlobDetector::Params SimpleBlobDetector_Params;
typedef AKAZE::DescriptorType AKAZE_DescriptorType;
typedef AgastFeatureDetector::DetectorType AgastFeatureDetector_DetectorType;
Expand All @@ -28,7 +48,7 @@ typedef ORB::ScoreType ORB_ScoreType;

#ifdef HAVE_OPENCV_OBJDETECT

#include "opencv2/objdetect.hpp"
#include <opencv2/objdetect.hpp>

typedef HOGDescriptor::HistogramNormType HOGDescriptor_HistogramNormType;
typedef HOGDescriptor::DescriptorStorageFormat HOGDescriptor_DescriptorStorageFormat;
Expand All @@ -43,6 +63,11 @@ typedef flann::IndexParams flann_IndexParams;
typedef flann::SearchParams flann_SearchParams;
#endif

#ifdef HAVE_OPENCV_DNN
typedef cv::dnn::DictValue LayerId;
typedef cv::dnn::Backend dnn_Backend;
#endif

template <typename C>
struct get_template_type;
template <typename C>
Expand Down Expand Up @@ -75,7 +100,10 @@ struct force_enum_int{
using Type = typename force_enum<T, std::is_enum<T>::value>::Type;
};

#define vector_Mat vector<Mat>
#define vector_UMat vector<UMat>
typedef vector<Mat> vector_Mat;
typedef vector<UMat> vector_UMat;

typedef char* c_string;


#include "jlcv2_types.hpp"
6 changes: 3 additions & 3 deletions src2/autogen_jl/Mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct Mat{T <: dtypes} <: AbstractArray{T,3}
new{T}(mat, data_raw, data)
end

@inline function Mat{T}(data_raw::AbstractArray{T, 3}) where {T <: dtypes}
@inline function Mat(data_raw::AbstractArray{T, 3}) where {T <: dtypes}
data = reinterpret(T, data_raw)
mat = nothing
new{T}(mat, data_raw, data)
Expand All @@ -31,7 +31,7 @@ Base.axes(A::Mat) = axes(A.data)
Base.IndexStyle(::Type{Mat{T}}) where {T} = IndexCartesian()

Base.strides(A::Mat{T}) where {T} = strides(A.data)
Base.copy(A::Mat{T}) where {T} = Mat{T}(copy(A.data_raw))
Base.copy(A::Mat{T}) where {T} = Mat(copy(A.data_raw))
Base.pointer(A::Mat) = Base.pointer(A.data)

Base.unsafe_convert(::Type{Ptr{T}}, A::Mat{S}) where {T, S} = Base.unsafe_convert(Ptr{T}, A.data)
Expand All @@ -46,4 +46,4 @@ end
@boundscheck checkbounds(A.data, I...)
A.data[I...] = x
return A
end
end
6 changes: 6 additions & 0 deletions src2/autogen_jl/cv_Error_cxx_wrap.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@


const Code = Int32



118 changes: 118 additions & 0 deletions src2/autogen_jl/cv_Error_wrap.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
module Error
import ..OpenCV


const BadAlign = OpenCV.cv_Error_BadAlign
const BAD_ALIGN = OpenCV.cv_Error_BAD_ALIGN;
const BadAlphaChannel = OpenCV.cv_Error_BadAlphaChannel
const BAD_ALPHA_CHANNEL = OpenCV.cv_Error_BAD_ALPHA_CHANNEL;
const BadCOI = OpenCV.cv_Error_BadCOI
const BAD_COI = OpenCV.cv_Error_BAD_COI;
const BadCallBack = OpenCV.cv_Error_BadCallBack
const BAD_CALL_BACK = OpenCV.cv_Error_BAD_CALL_BACK;
const BadDataPtr = OpenCV.cv_Error_BadDataPtr
const BAD_DATA_PTR = OpenCV.cv_Error_BAD_DATA_PTR;
const BadDepth = OpenCV.cv_Error_BadDepth
const BAD_DEPTH = OpenCV.cv_Error_BAD_DEPTH;
const BadImageSize = OpenCV.cv_Error_BadImageSize
const BAD_IMAGE_SIZE = OpenCV.cv_Error_BAD_IMAGE_SIZE;
const BadModelOrChSeq = OpenCV.cv_Error_BadModelOrChSeq
const BAD_MODEL_OR_CH_SEQ = OpenCV.cv_Error_BAD_MODEL_OR_CH_SEQ;
const BadNumChannel1U = OpenCV.cv_Error_BadNumChannel1U
const BAD_NUM_CHANNEL1U = OpenCV.cv_Error_BAD_NUM_CHANNEL1U;
const BadNumChannels = OpenCV.cv_Error_BadNumChannels
const BAD_NUM_CHANNELS = OpenCV.cv_Error_BAD_NUM_CHANNELS;
const BadOffset = OpenCV.cv_Error_BadOffset
const BAD_OFFSET = OpenCV.cv_Error_BAD_OFFSET;
const BadOrder = OpenCV.cv_Error_BadOrder
const BAD_ORDER = OpenCV.cv_Error_BAD_ORDER;
const BadOrigin = OpenCV.cv_Error_BadOrigin
const BAD_ORIGIN = OpenCV.cv_Error_BAD_ORIGIN;
const BadROISize = OpenCV.cv_Error_BadROISize
const BAD_ROISIZE = OpenCV.cv_Error_BAD_ROISIZE;
const BadStep = OpenCV.cv_Error_BadStep
const BAD_STEP = OpenCV.cv_Error_BAD_STEP;
const BadTileSize = OpenCV.cv_Error_BadTileSize
const BAD_TILE_SIZE = OpenCV.cv_Error_BAD_TILE_SIZE;
const GpuApiCallError = OpenCV.cv_Error_GpuApiCallError
const GPU_API_CALL_ERROR = OpenCV.cv_Error_GPU_API_CALL_ERROR;
const GpuNotSupported = OpenCV.cv_Error_GpuNotSupported
const GPU_NOT_SUPPORTED = OpenCV.cv_Error_GPU_NOT_SUPPORTED;
const HeaderIsNull = OpenCV.cv_Error_HeaderIsNull
const HEADER_IS_NULL = OpenCV.cv_Error_HEADER_IS_NULL;
const MaskIsTiled = OpenCV.cv_Error_MaskIsTiled
const MASK_IS_TILED = OpenCV.cv_Error_MASK_IS_TILED;
const OpenCLApiCallError = OpenCV.cv_Error_OpenCLApiCallError
const OPEN_CLAPI_CALL_ERROR = OpenCV.cv_Error_OPEN_CLAPI_CALL_ERROR;
const OpenCLDoubleNotSupported = OpenCV.cv_Error_OpenCLDoubleNotSupported
const OPEN_CLDOUBLE_NOT_SUPPORTED = OpenCV.cv_Error_OPEN_CLDOUBLE_NOT_SUPPORTED;
const OpenCLInitError = OpenCV.cv_Error_OpenCLInitError
const OPEN_CLINIT_ERROR = OpenCV.cv_Error_OPEN_CLINIT_ERROR;
const OpenCLNoAMDBlasFft = OpenCV.cv_Error_OpenCLNoAMDBlasFft
const OPEN_CLNO_AMDBLAS_FFT = OpenCV.cv_Error_OPEN_CLNO_AMDBLAS_FFT;
const OpenGlApiCallError = OpenCV.cv_Error_OpenGlApiCallError
const OPEN_GL_API_CALL_ERROR = OpenCV.cv_Error_OPEN_GL_API_CALL_ERROR;
const OpenGlNotSupported = OpenCV.cv_Error_OpenGlNotSupported
const OPEN_GL_NOT_SUPPORTED = OpenCV.cv_Error_OPEN_GL_NOT_SUPPORTED;
const StsAssert = OpenCV.cv_Error_StsAssert
const STS_ASSERT = OpenCV.cv_Error_STS_ASSERT;
const StsAutoTrace = OpenCV.cv_Error_StsAutoTrace
const STS_AUTO_TRACE = OpenCV.cv_Error_STS_AUTO_TRACE;
const StsBackTrace = OpenCV.cv_Error_StsBackTrace
const STS_BACK_TRACE = OpenCV.cv_Error_STS_BACK_TRACE;
const StsBadArg = OpenCV.cv_Error_StsBadArg
const STS_BAD_ARG = OpenCV.cv_Error_STS_BAD_ARG;
const StsBadFlag = OpenCV.cv_Error_StsBadFlag
const STS_BAD_FLAG = OpenCV.cv_Error_STS_BAD_FLAG;
const StsBadFunc = OpenCV.cv_Error_StsBadFunc
const STS_BAD_FUNC = OpenCV.cv_Error_STS_BAD_FUNC;
const StsBadMask = OpenCV.cv_Error_StsBadMask
const STS_BAD_MASK = OpenCV.cv_Error_STS_BAD_MASK;
const StsBadMemBlock = OpenCV.cv_Error_StsBadMemBlock
const STS_BAD_MEM_BLOCK = OpenCV.cv_Error_STS_BAD_MEM_BLOCK;
const StsBadPoint = OpenCV.cv_Error_StsBadPoint
const STS_BAD_POINT = OpenCV.cv_Error_STS_BAD_POINT;
const StsBadSize = OpenCV.cv_Error_StsBadSize
const STS_BAD_SIZE = OpenCV.cv_Error_STS_BAD_SIZE;
const StsDivByZero = OpenCV.cv_Error_StsDivByZero
const STS_DIV_BY_ZERO = OpenCV.cv_Error_STS_DIV_BY_ZERO;
const StsError = OpenCV.cv_Error_StsError
const STS_ERROR = OpenCV.cv_Error_STS_ERROR;
const StsFilterOffsetErr = OpenCV.cv_Error_StsFilterOffsetErr
const STS_FILTER_OFFSET_ERR = OpenCV.cv_Error_STS_FILTER_OFFSET_ERR;
const StsFilterStructContentErr = OpenCV.cv_Error_StsFilterStructContentErr
const STS_FILTER_STRUCT_CONTENT_ERR = OpenCV.cv_Error_STS_FILTER_STRUCT_CONTENT_ERR;
const StsInplaceNotSupported = OpenCV.cv_Error_StsInplaceNotSupported
const STS_INPLACE_NOT_SUPPORTED = OpenCV.cv_Error_STS_INPLACE_NOT_SUPPORTED;
const StsInternal = OpenCV.cv_Error_StsInternal
const STS_INTERNAL = OpenCV.cv_Error_STS_INTERNAL;
const StsKernelStructContentErr = OpenCV.cv_Error_StsKernelStructContentErr
const STS_KERNEL_STRUCT_CONTENT_ERR = OpenCV.cv_Error_STS_KERNEL_STRUCT_CONTENT_ERR;
const StsNoConv = OpenCV.cv_Error_StsNoConv
const STS_NO_CONV = OpenCV.cv_Error_STS_NO_CONV;
const StsNoMem = OpenCV.cv_Error_StsNoMem
const STS_NO_MEM = OpenCV.cv_Error_STS_NO_MEM;
const StsNotImplemented = OpenCV.cv_Error_StsNotImplemented
const STS_NOT_IMPLEMENTED = OpenCV.cv_Error_STS_NOT_IMPLEMENTED;
const StsNullPtr = OpenCV.cv_Error_StsNullPtr
const STS_NULL_PTR = OpenCV.cv_Error_STS_NULL_PTR;
const StsObjectNotFound = OpenCV.cv_Error_StsObjectNotFound
const STS_OBJECT_NOT_FOUND = OpenCV.cv_Error_STS_OBJECT_NOT_FOUND;
const StsOk = OpenCV.cv_Error_StsOk
const STS_OK = OpenCV.cv_Error_STS_OK;
const StsOutOfRange = OpenCV.cv_Error_StsOutOfRange
const STS_OUT_OF_RANGE = OpenCV.cv_Error_STS_OUT_OF_RANGE;
const StsParseError = OpenCV.cv_Error_StsParseError
const STS_PARSE_ERROR = OpenCV.cv_Error_STS_PARSE_ERROR;
const StsUnmatchedFormats = OpenCV.cv_Error_StsUnmatchedFormats
const STS_UNMATCHED_FORMATS = OpenCV.cv_Error_STS_UNMATCHED_FORMATS;
const StsUnmatchedSizes = OpenCV.cv_Error_StsUnmatchedSizes
const STS_UNMATCHED_SIZES = OpenCV.cv_Error_STS_UNMATCHED_SIZES;
const StsUnsupportedFormat = OpenCV.cv_Error_StsUnsupportedFormat
const STS_UNSUPPORTED_FORMAT = OpenCV.cv_Error_STS_UNSUPPORTED_FORMAT;
const StsVecLengthErr = OpenCV.cv_Error_StsVecLengthErr
const STS_VEC_LENGTH_ERR = OpenCV.cv_Error_STS_VEC_LENGTH_ERR;



end
13 changes: 2 additions & 11 deletions src2/autogen_jl/cv_core.jl
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
include("cv_cxx.jl")

module OpenCV
import ..OpenCVCxx

const dtypes = OpenCVCxx.dtypes
size_t = OpenCVCxx.size_t
import Base.size

const Mat = OpenCVCxx.Mat
include("cv_cxx.jl")

const Image = OpenCVCxx.Image
const Scalar = OpenCVCxx.Scalar
const Point = OpenCVCxx.Point
const Size = OpenCVCxx.Point
const Rect = OpenCVCxx.Rect
const Point3 = OpenCVCxx.Point3

include("cv_wrap.jl")

Expand Down
4 changes: 4 additions & 0 deletions src2/autogen_jl/cv_cuda_cxx_wrap.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@




8 changes: 8 additions & 0 deletions src2/autogen_jl/cv_cuda_wrap.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module cuda
import ..OpenCV





end
4 changes: 4 additions & 0 deletions src2/autogen_jl/cv_cudev_cxx_wrap.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@




8 changes: 8 additions & 0 deletions src2/autogen_jl/cv_cudev_wrap.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module cudev
import ..OpenCV





end
26 changes: 8 additions & 18 deletions src2/autogen_jl/cv_cxx.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
module OpenCVCxx
# using StaticArrays

include("typestructs.jl")
Expand All @@ -15,11 +14,11 @@ function __init__()
size_t = UInt32
end
end
const Scalar = Union{Tuple{Number}, Tuple{Number, Number}, Tuple{Number, Number, Number}, NTuple{4, Number}}
const Scalar = Union{Tuple{}, Tuple{Number}, Tuple{Number, Number}, Tuple{Number, Number, Number}, NTuple{4, Number}}

include("Mat.jl")

const Image = Union{Mat{A} where {A}, SubArray{T2, N, Mat{A}, T} where {N, A, T, T2 <: dtypes}, CxxMat}
const InputArray = Union{AbstractArray{T, 3} where {T <: dtypes}, CxxMat}

include("mat_conversion.jl")
include("types_conversion.jl")
Expand All @@ -31,23 +30,14 @@ function julia_to_cpp(var)
return var
end


function julia_to_cpp(var::Array{T, 1}) where {T}
ret = CxxWrap.StdVector{T}()
for x in var
push!(ret, julia_to_cpp(x)) # When converting an array keep expected type as final type.
end
return ret
end

function cpp_to_julia(var::CxxWrap.StdVector{T}) where {T}
ret = CxxWrap.StdVector{T}()
for x in var
push!(ret, cpp_to_julia(x))
function cpp_to_julia(var::Tuple)
ret_arr = Array{Any, 1}()
for it in var
push!(ret_arr, cpp_to_julia(it))
end
return ret
return tuple(ret_arr...)
end

include("cv_cxx_wrap.jl")

end
include("cv_manual_wrap.jl")
Loading

0 comments on commit c9730c5

Please sign in to comment.