How to set area for target in OpenCV andoidHow do save an Android Activity state using save instance state?Why is the Android emulator so slow? How can we speed up the Android emulator?How do I fix android.os.NetworkOnMainThreadException?How to find contours in an image in OpenCV?Image Processing: Algorithm Improvement for 'Coca-Cola Can' RecognitionWhat is a “twice HSV transformation”?C# EmguCV/OpenCV Find Square ImplementationFind and eliminate contours opencvopenCV: cannot detect small shapes using findContoursIncrease the degree of a specific color range in an image for object detection
What is Cash Advance APR?
What are the advantages of simplicial model categories over non-simplicial ones?
Unexpected behavior of the procedure `Area` on the object 'Polygon'
What if a revenant (monster) gains fire resistance?
Limits and Infinite Integration by Parts
How do I delete all blank lines in a buffer?
Invalid date error by date command
How much character growth crosses the line into breaking the character
Mixing PEX brands
How does a computer interpret real numbers?
Are Captain Marvel's powers affected by Thanos' actions in Infinity War
Why is it that I can sometimes guess the next note?
Can disgust be a key component of horror?
What are some good ways to treat frozen vegetables such that they behave like fresh vegetables when stir frying them?
How to hide some fields of struct in C?
Does IPv6 have similar concept of network mask?
What is the evidence for the "tyranny of the majority problem" in a direct democracy context?
What are the balance implications behind making invisible things auto-hide?
Does the Linux kernel need a file system to run?
What if you are holding an Iron Flask with a demon inside and walk into Antimagic Field?
Open a doc from terminal, but not by its name
Why should universal income be universal?
What exact color does ozone gas have?
How to say when an application is taking the half of your screen on a computer
How to set area for target in OpenCV andoid
How do save an Android Activity state using save instance state?Why is the Android emulator so slow? How can we speed up the Android emulator?How do I fix android.os.NetworkOnMainThreadException?How to find contours in an image in OpenCV?Image Processing: Algorithm Improvement for 'Coca-Cola Can' RecognitionWhat is a “twice HSV transformation”?C# EmguCV/OpenCV Find Square ImplementationFind and eliminate contours opencvopenCV: cannot detect small shapes using findContoursIncrease the degree of a specific color range in an image for object detection
I am working with OpenCV android target detection(Red Dot), and its working perfectly, but now i want to get red dot in given area(defined red square) only.
any one have a idea how to do?
thats my code
// down-scale and upscale the image to filter out the noise
Imgproc.pyrDown(gray, downscaled, new Size(gray.cols() / 2, gray.rows() / 2));
Imgproc.pyrUp(downscaled, upscaled, gray.size());
if (DETECT_RED_OBJECTS_ONLY )
// convert the image from RGBA to HSV
Imgproc.cvtColor(gray, hsv, Imgproc.COLOR_RGB2HSV);
// threshold the image for the lower and upper HSV red range
Core.inRange(hsv, HSV_LOW_RED1, HSV_LOW_RED2, lowerRedRange);
Core.inRange(hsv, HSV_HIGH_RED1, HSV_HIGH_RED2, upperRedRange);
// put the two thresholded images together
Core.addWeighted(lowerRedRange, 1.0, upperRedRange, 1.0, 0.0, bw);
// apply canny to get edges only
Imgproc.Canny(bw, bw, 0, 255);
else
// Use Canny instead of threshold to catch squares with gradient shading
Imgproc.Canny(gray, bw, 0, 255);
// dilate canny output to remove potential
// holes between edge segments
Imgproc.dilate(bw, bw, new Mat(), new Point(-1, 1), 1);
// find contours and store them all as a list
List<MatOfPoint> contours = new ArrayList<>();
contourImage = bw.clone();
Imgproc.findContours(
contourImage,
contours,
hierarchyOutputVector,
Imgproc.RETR_EXTERNAL,
Imgproc.CHAIN_APPROX_SIMPLE
);
// loop over all found contours
for (MatOfPoint cnt : contours) {
MatOfPoint2f curve = new MatOfPoint2f(cnt.toArray());
// approximates a polygonal curve with the specified precision
Imgproc.approxPolyDP(curve,approxCurve,0.02 * Imgproc.arcLength(curve, true),true);
int numberVertices = (int) approxCurve.total();
double contourArea = Imgproc.contourArea(cnt);
// ignore to small areas
if (Math.abs(contourArea) < 100
// || !Imgproc.isContourConvex(
)
continue;
android opencv reddot
add a comment |
I am working with OpenCV android target detection(Red Dot), and its working perfectly, but now i want to get red dot in given area(defined red square) only.
any one have a idea how to do?
thats my code
// down-scale and upscale the image to filter out the noise
Imgproc.pyrDown(gray, downscaled, new Size(gray.cols() / 2, gray.rows() / 2));
Imgproc.pyrUp(downscaled, upscaled, gray.size());
if (DETECT_RED_OBJECTS_ONLY )
// convert the image from RGBA to HSV
Imgproc.cvtColor(gray, hsv, Imgproc.COLOR_RGB2HSV);
// threshold the image for the lower and upper HSV red range
Core.inRange(hsv, HSV_LOW_RED1, HSV_LOW_RED2, lowerRedRange);
Core.inRange(hsv, HSV_HIGH_RED1, HSV_HIGH_RED2, upperRedRange);
// put the two thresholded images together
Core.addWeighted(lowerRedRange, 1.0, upperRedRange, 1.0, 0.0, bw);
// apply canny to get edges only
Imgproc.Canny(bw, bw, 0, 255);
else
// Use Canny instead of threshold to catch squares with gradient shading
Imgproc.Canny(gray, bw, 0, 255);
// dilate canny output to remove potential
// holes between edge segments
Imgproc.dilate(bw, bw, new Mat(), new Point(-1, 1), 1);
// find contours and store them all as a list
List<MatOfPoint> contours = new ArrayList<>();
contourImage = bw.clone();
Imgproc.findContours(
contourImage,
contours,
hierarchyOutputVector,
Imgproc.RETR_EXTERNAL,
Imgproc.CHAIN_APPROX_SIMPLE
);
// loop over all found contours
for (MatOfPoint cnt : contours) {
MatOfPoint2f curve = new MatOfPoint2f(cnt.toArray());
// approximates a polygonal curve with the specified precision
Imgproc.approxPolyDP(curve,approxCurve,0.02 * Imgproc.arcLength(curve, true),true);
int numberVertices = (int) approxCurve.total();
double contourArea = Imgproc.contourArea(cnt);
// ignore to small areas
if (Math.abs(contourArea) < 100
// || !Imgproc.isContourConvex(
)
continue;
android opencv reddot
You should use ROI but since you did not supply us a minimum code example, I cannot tell you more.
– Celal Ergün
yesterday
hey Celal Ergün thanks for reply, check my edited question
– Mr. Programmer
yesterday
add a comment |
I am working with OpenCV android target detection(Red Dot), and its working perfectly, but now i want to get red dot in given area(defined red square) only.
any one have a idea how to do?
thats my code
// down-scale and upscale the image to filter out the noise
Imgproc.pyrDown(gray, downscaled, new Size(gray.cols() / 2, gray.rows() / 2));
Imgproc.pyrUp(downscaled, upscaled, gray.size());
if (DETECT_RED_OBJECTS_ONLY )
// convert the image from RGBA to HSV
Imgproc.cvtColor(gray, hsv, Imgproc.COLOR_RGB2HSV);
// threshold the image for the lower and upper HSV red range
Core.inRange(hsv, HSV_LOW_RED1, HSV_LOW_RED2, lowerRedRange);
Core.inRange(hsv, HSV_HIGH_RED1, HSV_HIGH_RED2, upperRedRange);
// put the two thresholded images together
Core.addWeighted(lowerRedRange, 1.0, upperRedRange, 1.0, 0.0, bw);
// apply canny to get edges only
Imgproc.Canny(bw, bw, 0, 255);
else
// Use Canny instead of threshold to catch squares with gradient shading
Imgproc.Canny(gray, bw, 0, 255);
// dilate canny output to remove potential
// holes between edge segments
Imgproc.dilate(bw, bw, new Mat(), new Point(-1, 1), 1);
// find contours and store them all as a list
List<MatOfPoint> contours = new ArrayList<>();
contourImage = bw.clone();
Imgproc.findContours(
contourImage,
contours,
hierarchyOutputVector,
Imgproc.RETR_EXTERNAL,
Imgproc.CHAIN_APPROX_SIMPLE
);
// loop over all found contours
for (MatOfPoint cnt : contours) {
MatOfPoint2f curve = new MatOfPoint2f(cnt.toArray());
// approximates a polygonal curve with the specified precision
Imgproc.approxPolyDP(curve,approxCurve,0.02 * Imgproc.arcLength(curve, true),true);
int numberVertices = (int) approxCurve.total();
double contourArea = Imgproc.contourArea(cnt);
// ignore to small areas
if (Math.abs(contourArea) < 100
// || !Imgproc.isContourConvex(
)
continue;
android opencv reddot
I am working with OpenCV android target detection(Red Dot), and its working perfectly, but now i want to get red dot in given area(defined red square) only.
any one have a idea how to do?
thats my code
// down-scale and upscale the image to filter out the noise
Imgproc.pyrDown(gray, downscaled, new Size(gray.cols() / 2, gray.rows() / 2));
Imgproc.pyrUp(downscaled, upscaled, gray.size());
if (DETECT_RED_OBJECTS_ONLY )
// convert the image from RGBA to HSV
Imgproc.cvtColor(gray, hsv, Imgproc.COLOR_RGB2HSV);
// threshold the image for the lower and upper HSV red range
Core.inRange(hsv, HSV_LOW_RED1, HSV_LOW_RED2, lowerRedRange);
Core.inRange(hsv, HSV_HIGH_RED1, HSV_HIGH_RED2, upperRedRange);
// put the two thresholded images together
Core.addWeighted(lowerRedRange, 1.0, upperRedRange, 1.0, 0.0, bw);
// apply canny to get edges only
Imgproc.Canny(bw, bw, 0, 255);
else
// Use Canny instead of threshold to catch squares with gradient shading
Imgproc.Canny(gray, bw, 0, 255);
// dilate canny output to remove potential
// holes between edge segments
Imgproc.dilate(bw, bw, new Mat(), new Point(-1, 1), 1);
// find contours and store them all as a list
List<MatOfPoint> contours = new ArrayList<>();
contourImage = bw.clone();
Imgproc.findContours(
contourImage,
contours,
hierarchyOutputVector,
Imgproc.RETR_EXTERNAL,
Imgproc.CHAIN_APPROX_SIMPLE
);
// loop over all found contours
for (MatOfPoint cnt : contours) {
MatOfPoint2f curve = new MatOfPoint2f(cnt.toArray());
// approximates a polygonal curve with the specified precision
Imgproc.approxPolyDP(curve,approxCurve,0.02 * Imgproc.arcLength(curve, true),true);
int numberVertices = (int) approxCurve.total();
double contourArea = Imgproc.contourArea(cnt);
// ignore to small areas
if (Math.abs(contourArea) < 100
// || !Imgproc.isContourConvex(
)
continue;
android opencv reddot
android opencv reddot
edited yesterday
Mr. Programmer
asked yesterday
Mr. ProgrammerMr. Programmer
96
96
You should use ROI but since you did not supply us a minimum code example, I cannot tell you more.
– Celal Ergün
yesterday
hey Celal Ergün thanks for reply, check my edited question
– Mr. Programmer
yesterday
add a comment |
You should use ROI but since you did not supply us a minimum code example, I cannot tell you more.
– Celal Ergün
yesterday
hey Celal Ergün thanks for reply, check my edited question
– Mr. Programmer
yesterday
You should use ROI but since you did not supply us a minimum code example, I cannot tell you more.
– Celal Ergün
yesterday
You should use ROI but since you did not supply us a minimum code example, I cannot tell you more.
– Celal Ergün
yesterday
hey Celal Ergün thanks for reply, check my edited question
– Mr. Programmer
yesterday
hey Celal Ergün thanks for reply, check my edited question
– Mr. Programmer
yesterday
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280664%2fhow-to-set-area-for-target-in-opencv-andoid%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280664%2fhow-to-set-area-for-target-in-opencv-andoid%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You should use ROI but since you did not supply us a minimum code example, I cannot tell you more.
– Celal Ergün
yesterday
hey Celal Ergün thanks for reply, check my edited question
– Mr. Programmer
yesterday