I've been trying to follow tutorials for javacv from various tutorial sites, but the biggest problem was that almost every single tutorials use cvCreate... methods to bring images and videos. But when I type those in, I can't find the methods in any libraries. I downloaded the latest javacv-bin file from bytedeco and added all the libraries from that download to my project, but it's still not working. Other classes such as Mat, CvCapture work perfectly. What can be the problem?
here's one tutorial i've been following:
https://www.youtube.com/watch?v=oliqc3B9Wrc&index=3&list=PLDk0xqo2QeH-4XZ93KH38jOoGOd60-2GO
P.S.
Can you recommand any javacv and java tutorial for beginners?
I'm stuck trying to use built in webcam on my laptop to do basic camera features such as capturing and recording.
Did you statically import packages like below ?
import static org.bytedeco.javacpp.opencv_core.*;
import static org.bytedeco.javacpp.opencv_imgproc.*;
import static org.bytedeco.javacpp.opencv_videoio.*;
Related
I'm building an Android app in Xamarin.Android. In Java terms, I need to import android.support.design.widget.CoordinatorLayout;. How can I do this with a C# using statement?
Xamarin intellisense won't let me go past using Android.Support. When I add .Design it tells me the using directive is unnecessary, and throws build errors.
Can you please help me?
It sounds like you're missing a component. Try including the Android Design Support Library component, I think it'll fix your problem.
If that doesn't work, try the steps listed in this question.
Double click on your packages folder inside your Xamarin Android project. The NuGet package search window will appear. In the search field (top right corner) type "Xamarin.Android.support.design". Select the package from Xamarin Inc.
Also helpful might be Xamarin.Android.Support.Contraint.Layout and Xamarin.Android.Support.Contraint.Layout.Solver. These are pre-release packages so you need to check the "Show pre-release packages" checkbox.
Use using Android.Support.Design.Widget; and make sure you're using the Xamarin.Android.Support.Design package from NuGet.
I am getting an error on an import statement that I am using in order to try and implement Play Games with my app.
-The import com.google.android.gms.games.GamesClient cannot be resolved
I have BaseGameUtils referecncing google-play-services_lib, and my project references BaseGameUtils as a library.
It's my understanding that GameClient was to have been deprecated as of February 7, 2014 but when looking at Google's sample code (e.g. ButtonClicker) it still uses this import and some of the method calls from the import.
I got the code I am using from Google's GitHub sample app repository for the ButtonClicker2000, some of that code has been recycled and used in the program I'm having errors with as well.
This is all the info I can think to provide, if anything more would help please let me know.
I was struggling with the ButtonClicker2000 example for a couple days and I was having the same problem as yours.
I think the problem in the sample code is having some lines being not updated. If you look at that page, you can easily see that the updated versions of those lines are lying there. However the codes in GitHub page are not updated completely.
Because GamesClient class is removed permanently, those statements
GamesClient.EXTRA_PLAYERS
GamesClient.EXTRA_MIN_AUTOMATCH_PLAYERS
GamesClient.EXTRA_MAX_AUTOMATCH_PLAYERS
GamesClient.EXTRA_INVITATION
GamesClient.STATUS_OK
must be replaced with
Games.EXTRA_PLAYERS_IDS
Multiplayer.EXTRA_MIN_AUTOMATCH_PLAYERS
Multiplayer.EXTRA_MAX_AUTOMATCH_PLAYERS
Multiplayer.EXTRA_INVITATION
GamesStatusCodes.STATUS_OK
Also that line can be removed:
import com.google.android.gms.games.GamesClient;
There is no need for importing GoogleApiClient because it is already imported in GameHelper.java.
After changing these lines manually and importing Multiplayer and GamesStatusCodes classes, I was successful to compile the code. I hope that solves your problem as well.
I am having trouble with nonfree methdos usage in android. SIFT and SURF methods are not included in opencv-android-2.4.8. They are needed to be complied seperately.
https://sites.google.com/site/wghsite/technical-notes/sift_surf_opencv_android
This is the main tutorial about nonfree module compilation. However, the jni part for java users are not included. I have searched how to use compiled .so libraries but I could not achieve.
I wonder that someone can share the jni part for nonfree modules or detailed explanation for it, because I work on that issue over a week and I could not do it.
Thanks.
I am the author of the tutorial. I will be adding another tutorial showing the JNI part. Hope that will help. Please go back and check the tutorial in the next couple of days. I will post it soon.
I solved the problem. When you follow the tutorial(the link given in the question) you get the necessary libraries(.so files). In order to use them in java you do not need to implement jni part. When you load the libraries in your java code (System.load(libraryName)), then you can use sift and surf methods like the other detectors or descriptors. You can directly use the code pattern supplied by the opencv-2.4.8.
Assuming that you've already gotten OpenCV 4 Android to work on your Android device;
1) I placed libnonfree.so, libopencv_java.so and libgnustl_shared.so (not sure if the last one is needed) in the correct folder for your platform, in my case jniLibs/armeabi-v7a. Already compiled version can be find in the demo folder here; https://github.com/bkornel/opencv_android_nonfree
2) Make sure you load both libraries.
static {
System.loadLibrary("opencv_java");
System.loadLibrary("nonfree");
}
This was all that was required in order for it to work for me.
#fetifati, Do you mean to say that if I copy libnonfree.so and libopencv_java.so in say lib/armeabi folder and do System.load("nonfree"); System.load("opencv_java"), I can use code like:
private static final FeatureDetector detector = FeatureDetector
.create(FeatureDetector.SIFT);
private static final DescriptorExtractor extractor = DescriptorExtractor
.create(DescriptorExtractor.SIFT);
directly ? ... It doesn't seem to work for me. I am getting some errors.
I want to take an image from webcam. How can I do this?
If is there any sample codes for your advice library, it's better than other for me.
I examined these:
Jmyron
Java Media Framework
JavaCV
lt-civil
These are not useful. These do not work or do not have sample code.
Have you got any advice?
Try this project:
http://github.com/rladstaetter/isight-java/
and the corresponding blog post
http://ladstatt.blogspot.co.at/2013/04/using-isight-camera-with-javafx.html
Keep in mind that you'll have to have the correct opencv dll for your architecture (x64)
I stripped down OpenIMAJ Core Video Capture Library to get images from webcam. It works well on my macbook, linux deskdop and windows 7 env.
You don't need to install anything, two jars are all you need. You can find the example from my site:
http://www.sleepingdumpling.com/blog/download/jvideoinput/
Here is a link to a Demonstration JavaFX Camera capture application using LTI-CIVIL
You are correct that the LTI-CIVIL library is 32 bit only, so perhaps not useful In your case if 64 bit is an imperative.
I'm creating some help content for an application (built on NetBeans), and thought it would be useful in some cases to be able do show a tutorial video within the JavaHelp or have a link to open a video.
I'd imagine it would be possible using the <OBJECT> tag perhaps, but I don't know which object to embed. What little I know of JavaHelp I've gotten from http://download.java.net/javadesktop/javahelp/jhug.pdf, and from that I conclude that I should get some Lightweight Java Component capable of playing a .avi and embed it with the <object> tag. Or rather have a link in the help that opens the .avi in a seperate window.
Does anyone have any pointers on how this is done?
Edit:
I've tried some more on adding a lightweight component of my own, but to no success. So I wonder if I'm placing the component in the wrong place. If i try to add a JButton to the JavaHelp with
<object
classid="java:javax.swing.JButton">
</object>
it appears in the JavaHelp just fine.
if I try a button of my own, like
<object
classid="java:my.module.TestButton">
</object>
I just get a couple of red "???"
The class TestBytton is just
package my.module;
import javax.swing.JButton;
public class TestButton extends JButton{
}
The TestButton lies in the same NetBeans project as the javahelp-html, and the package the TestButton lies in is public. Any ideas?
Edit2:
Ok, so i've looked into this some more. It seems that eventually the class com.sun.java.help.impl.CustomKit$CustomDocument will try to do a
getClass().getClassLoader().loadClass("my.module.TestButton")
And that will result in a ClassNotFoundException. That might be if i understood it correctly because the classloader that will be used will only find classes that are in the
netbeans module called JavaHelp Integration. And among those are not my.module.TestButton. So... I'm stuck once more. I don't think i can add anything to that module easily.
.
I do not know of any way to embed video in JavaHelp this way. But you should be able to create a regular hyperlink to an HTML file embedding the video (in some manner), for use from an external browser. http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-javahelp/org/netbeans/api/javahelp/doc-files/api.html#external-links shows how to make the links.
If you want this to work offline, include the HTML in your NBM fileset and use the nbinst URL protocol; for example, if in release/docs/helpvid.html in sources (for an Ant-based NBM project), nbinst://my.module.code.name.base/docs/helpvid.html should link to it in the app's installation. As far as I know the JavaHelp module's link handler will convert the URL to an equivalent file-protocol URL before passing it to the configured web browser (defaulting to Desktop.browse on JDK 6+).
I know this is not the answer, but linking to some YouTube videos often is enought. And you get high quality videos without having to deploy them in the installer.