Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 289168 Details for
Bug 57784
[1.5] Errors using Arrays.asList(T [])
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
The method asList(T[]) in the type Arrays is not applicable for the arguments (Mat)
Ch12_1_1GetMotionByAbsdiff.java (text/plain), 3.92 KB, created by
wu kauzun
on 2023-09-03 23:02:34 EDT
(
hide
)
Description:
The method asList(T[]) in the type Arrays is not applicable for the arguments (Mat)
Filename:
MIME Type:
Creator:
wu kauzun
Created:
2023-09-03 23:02:34 EDT
Size:
3.92 KB
patch
obsolete
>package ch12; >import java.util.ArrayList; >import java.util.List; >import javax.swing.JFrame; >import org.opencv.core.Core; >import org.opencv.core.Mat; >import org.opencv.core.MatOfPoint; >import org.opencv.core.Point; >import org.opencv.core.Rect; >import org.opencv.core.Scalar; >import org.opencv.core.Size; >import org.opencv.highgui.VideoCapture; >import org.opencv.imgproc.Imgproc; >import org.opencv.core.CvType; > >public class Ch12_1_1GetMotionByAbsdiff { > static{ System.loadLibrary(Core.NATIVE_LIBRARY_NAME); } > public static void main(String arg[]){ > JFrame frame1 = new JFrame("Camera"); > frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); > frame1.setSize(640,480); > frame1.setBounds(0, 0, frame1.getWidth(), frame1.getHeight()); > Panel panel1 = new Panel(); > frame1.setContentPane(panel1); > frame1.setVisible(true); > > JFrame frame2 = new JFrame("Threshold"); > frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); > frame2.setSize(640,480); > frame2.setBounds(300,100, frame1.getWidth()+50, 50+frame1.getHeight()); > Panel panel2 = new Panel(); > frame2.setContentPane(panel2); > frame2.setVisible(true); > //-- 2. Read the video stream > VideoCapture capture =new VideoCapture(0); > Mat webcam_image=new Mat(); > capture.read(webcam_image); > frame1.setSize(webcam_image.width()+40,webcam_image.height()+60); > frame2.setSize(webcam_image.width()+40,webcam_image.height()+60); > > Mat image = null; > Mat prevImage = null; > Mat diff = null; > Mat mHierarchy = new Mat(); > > if( capture.isOpened()) > { > while( true ) > { > capture.read(webcam_image); > if( !webcam_image.empty() ) > { > Imgproc.GaussianBlur(webcam_image, webcam_image, new Size(9,9), 0, 0); > > if(image==null){ > image = new Mat(webcam_image.size(),CvType.CV_8U); > Imgproc.cvtColor(webcam_image, image, Imgproc.COLOR_RGB2GRAY); > }else{ > prevImage = new Mat(webcam_image.size(),CvType.CV_8U); > > prevImage = image; > > image = new Mat(webcam_image.size(),CvType.CV_8U); > Imgproc.cvtColor(webcam_image, image, Imgproc.COLOR_RGB2GRAY); > > } > > if(diff==null){ > diff = new Mat(webcam_image.size(),CvType.CV_8U); > } > > if (prevImage != null) { > > Core.absdiff(image, prevImage, diff); > > //64:åµæ¸¬å°æ¡æ¡è¼å¤,ä½éæ,127:åµæ¸¬å°æ¡æ¡è¼å°,ä½ä¸éæ > Imgproc.threshold(diff, diff, 64, 255, Imgproc.THRESH_BINARY); > List<MatOfPoint> contours = new ArrayList<MatOfPoint>(); > > Imgproc.findContours(diff, contours, mHierarchy, Imgproc.RETR_LIST, Imgproc.CHAIN_APPROX_SIMPLE); > /**ææ許å¤å°æ¡æ¡ > * **/ > for(int i=0;i<contours.size();i++) > { > Rect r = Imgproc.boundingRect(contours.get(i)); > int ContourArea = r.height* r.width; > if(ContourArea > 500) > { > Imgproc.drawContours(webcam_image, contours,i,new Scalar(255,0,0,255),-1); > //è£æå°ä½¿ç¨èè²è¡¨ç¤º > Core.rectangle(webcam_image, new Point(r.x, r.y), new Point(r.x + r.width, r.y + r.height), new Scalar(0, 255, 0)); > } > > } > > } > panel1.setimagewithMat(webcam_image); > panel2.setimagewithMat(diff); // > frame1.repaint(); > frame2.repaint(); > } > else > { > System.out.println(" ç¡è£æä»»ä½ç«é¢!"); > break; > } > } > } > return; > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 57784
: 289168