Closed jwijffels closed 4 years ago
Or similarly for reading only 1 channel (e.g. black/white images)
// [[Rcpp::export]]
XPtrMat cvmat_bw(Rcpp::RawVector img, int width = 0, int height = 0){
std::vector<uchar> x = Rcpp::as<std::vector<uchar>>(img);
cv::Mat output(height, width, CV_8U, x.data());
return cvmat_xptr(output);
}
Just listing more functions which I think could be useful
// [[Rcpp::export]]
XPtrMat cvmat_rect(XPtrMat ptr, int x, int y, int width = 0, int height = 0){
cv::Mat img = get_mat(ptr);
cv::Rect roi = cv::Rect(x, y, width, height);
cv::Mat output = img(roi);
return cvmat_xptr(output);
}
Would you like to be co-maintainer of this package? It would be helpful if somebody that has domain knowledge can help.
Yes, why not. Not sure if I am a complete computer vision expert but I sure need it in some work and happy to contribute.
OK I'll give you write access so you can make changes.
Sounds good. What is your opinion on the opencv package. E.g. could such things (or similar) be integrated https://github.com/DIGI-VUB/image.textlinedetector or will this package remain doing core opencv things?
I'm for core things only.
Added cvmat_raw_bgr and cvmat_raw_bw in https://github.com/ropensci/opencv/commit/b72e8190abaa9f3f65e02024fedee8026aa26f24 I'll start extending it with some core things.
Would be good to have such code included in
base.cpp
to pass common image data directly to opencv. And maybe map that option toocv_read
Such that one can do