Skip to content

Commit 7304cfb

Browse files
Merge pull request #4018 from Akhil-Chaturvedi:patch-1
[Saliency] Enable Java/Android bindings by adding 'WRAP java' to CMake #4018 Fixes #4016 This addresses the inability to use the `saliency` module in Android (Java/Kotlin) applications. When generated using `build_sdk.py`, the native library compiles, but the Java wrapper class (`org.opencv.saliency.Saliency`) is not generated. # Technical Fix: The `ocv_define_module` macro in `modules/saliency/CMakeLists.txt` was missing the `java` flag in its `WRAP` parameter. **Change in `modules/saliency/CMakeLists.txt`:** **OLD** ocv_define_module(saliency opencv_imgproc opencv_features2d WRAP python) **NEW** ocv_define_module(saliency opencv_imgproc opencv_features2d WRAP python java) ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
1 parent d147d10 commit 7304cfb

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

modules/saliency/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ endif()
44

55
set(the_description "Saliency API")
66

7-
ocv_define_module(saliency opencv_imgproc opencv_features2d WRAP python)
7+
ocv_define_module(saliency opencv_imgproc opencv_features2d WRAP python java)
88

99
ocv_warnings_disable(CMAKE_CXX_FLAGS -Woverloaded-virtual)

modules/saliency/include/opencv2/saliency/saliencySpecializedClasses.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class CV_EXPORTS_W StaticSaliencySpectralResidual : public StaticSaliency
8787
}
8888

8989
CV_WRAP void read( const FileNode& fn ) CV_OVERRIDE;
90-
void write( FileStorage& fs ) const CV_OVERRIDE;
90+
CV_WRAP void write( FileStorage& fs ) const CV_OVERRIDE;
9191

9292
CV_WRAP int getImageWidth() const
9393
{
@@ -308,9 +308,6 @@ class CV_EXPORTS_W ObjectnessBING : public Objectness
308308
return computeSaliencyImpl( image, saliencyMap );
309309
}
310310

311-
CV_WRAP void read();
312-
CV_WRAP void write() const;
313-
314311
/** @brief Return the list of the rectangles' objectness value,
315312
316313
in the same order as the *vector\<Vec4i\> objectnessBoundingBox* returned by the algorithm (in

modules/saliency/src/BING/objectnessBING.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -448,21 +448,12 @@ bool ObjectnessBING::matRead( const std::string& filename, Mat& _M )
448448
M.copyTo( _M );
449449
return true;
450450
}
451+
451452
std::vector<float> ObjectnessBING::getobjectnessValues()
452453
{
453454
return objectnessValues;
454455
}
455456

456-
void ObjectnessBING::read()
457-
{
458-
459-
}
460-
461-
void ObjectnessBING::write() const
462-
{
463-
464-
}
465-
466457
bool ObjectnessBING::computeSaliencyImpl( InputArray image, OutputArray objectnessBoundingBox )
467458
{
468459
ValStructVec<float, Vec4i> finalBoxes;

0 commit comments

Comments
 (0)