Announcement

Collapse
No announcement yet.

How to use the camera as a sensor

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #61
    Originally posted by Crossle86 View Post
    I'd be very interested in any references you can provide that discuss all of this. For example, what is "G-Channel"? Also waiting to try your openCV solution.

    We just used Android Studio to import OpenCVLibrary2411 into our GitHub clone of "ftc_app" as a new "module"; so it's now in the "ftc_app" project at the same directory level as that other "module" called "FtcRobotController".

    In addition, we installed one of the OpenCV SDK samples as an Android Studio "project": color-blob-detection.

    When run as an app on a ZTE phone, color-blob-detection shows us some performance that we now want to study. The app starts by waiting for the user to touch the phone's screen at the location of a particular color blob of interest. Once it has been "trained", the app looks around the field of view while the user is panning the phone from side to side. On a continuing basis, the app finds and marks the boundaries of all of the blobs of the chosen color that it can see at that moment.

    We really want to study the code that does that, and incorporate it into an imaging OpMode of some kind, with perhaps a function that finds and marks the centroid of a color blob.

    Comment


    • #62
      Originally posted by hexafraction View Post
      R,G,B are red, green, and blue channels, respectively. I'm going to try to formalize my statistical analysis a bit more before I actually try to explain it, since I'm barely understanding it myself. It basically works, and I don't know why. I didn't really consult anything except a few math teachers and Wikipedia. It probably involves a lot of considerations regarding color models, bayer filters, AWB algorithms, and other stuff beyond my current ability to explain. I'll try to do so in a document on Overleaf, which I'll link to sometime in the near future. I don't have time to get started on it today, though, and programming our robot for the competition is a top priority.
      Thanks for sharing knowledge and code (at your convenience). Saves me a lot of time as there are many other things to investigate besides vision. Same thanks to the rest of the posters on this thread.

      Comment


      • #63
        Originally posted by hexafraction View Post
        No, I don't have a robot to test on yet. We have a drivetrain but its not ready to be used for this testing. I'm just waving a ZTE speed in front of a light beacon (or at home, my personal phone in front of a JPEG image of the beacon).
        Oh, okay, (we aren't even that far in robot development) I am still figuring out an efficient way to get the image data from the camera to user code, since my integration of components is different it is somewhat more difficult to take a photo, but easy for the "user" to get the image data.

        Comment


        • #64
          Originally posted by dmssargent View Post
          Oh, okay, (we aren't even that far in robot development) I am still figuring out an efficient way to get the image data from the camera to user code, since my integration of components is different it is somewhat more difficult to take a photo, but easy for the "user" to get the image data.
          Are you currently calling a capture method that stores the image to disk? The easiest way so far I've seen is to start an image preview. You can then add a callback that fires for every frame received. My callback copies the image data to another thread's array to be processed, without blocking the main thread (since our preview callback runs on the UI thread for some reason).
          FTC6460 mentor (software+computer vision+electronics), FPGA enthusiast. In favor of allowing custom electronics on FTC bots.
          Co-founder of ##ftc live chat for FTC programming--currently you may need to join and wait some time for help--volunteer basis only.

          Comment


          • #65
            My problem is that no preview data is getting sent my preview callback, since the preview callback is never called, and the takePicture() method always gives the generic error message of "failed," but the preview works perfectly. Every image is currently being currently sent to an evicting queue, with the a new latest photo taken timestamp to relate to the new photo. I dislike error messages that only tell you that something failed, you have no clue why it is failing.

            Comment


            • #66
              Originally posted by dmssargent View Post
              My problem is that no preview data is getting sent my preview callback, since the preview callback is never called, and the takePicture() method always gives the generic error message of "failed," but the preview works perfectly. Every image is currently being currently sent to an evicting queue, with the a new latest photo taken timestamp to relate to the new photo. I dislike error messages that only tell you that something failed, you have no clue why it is failing.
              Have a look at https://github.com/niskyRobotics/swe...ityHelper.java. It's a giant mess at the moment, but it should be a good starting point for the sequence of necessary method calls, if you're able to decipher it (I currently am not able to follow its progress due to all of the changes made).
              FTC6460 mentor (software+computer vision+electronics), FPGA enthusiast. In favor of allowing custom electronics on FTC bots.
              Co-founder of ##ftc live chat for FTC programming--currently you may need to join and wait some time for help--volunteer basis only.

              Comment


              • #67
                Now I see that my problem was that I wasn't opening the camera inside the GUI thread, I fixed that and now everything works. I had the sequence right, just not on the right thread.

                Comment


                • #68
                  Just today, I got an answer to a Tournament Rules question that I posted about a month ago. It appears that, at the discretion of those who direct the tournaments, we will be allowed to take pictures or videos of the red and blue beacons at specified locations in the tournament venue on competition days. Please see the post #19 on the Tournament Rules Forum at: http://ftcforum.usfirst.org/showthre...0391#post20391

                  Comment


                  • #69
                    Does anyone know how to replicate this in MIT App Inventor???

                    Comment


                    • #70
                      Originally posted by ejgenius View Post
                      Does anyone know how to replicate this in MIT App Inventor???
                      I don't believe App Inventor will handle camera APIs. Additionally, you may need to import some libraries for more advanced analysis, which AI also probably can't do.
                      FTC6460 mentor (software+computer vision+electronics), FPGA enthusiast. In favor of allowing custom electronics on FTC bots.
                      Co-founder of ##ftc live chat for FTC programming--currently you may need to join and wait some time for help--volunteer basis only.

                      Comment


                      • #71
                        To use this, would the difference in the scope of the phone camera vs a sensor be negligible? or how would we compensate for it?

                        Comment


                        • #72
                          Originally posted by anisha View Post
                          To use this, would the difference in the scope of the phone camera vs a sensor be negligible? or how would we compensate for it?
                          The camera is a different sensor with different light response and thus your code may need to interpret the data from it differently.
                          FTC6460 mentor (software+computer vision+electronics), FPGA enthusiast. In favor of allowing custom electronics on FTC bots.
                          Co-founder of ##ftc live chat for FTC programming--currently you may need to join and wait some time for help--volunteer basis only.

                          Comment

                          Working...
                          X