Navigation

    VisionAppster.com

    VisionAppster Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. Topi
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 35
    • Best 5
    • Groups 2

    Topi

    @Topi

    administrators

    6
    Reputation
    290
    Profile views
    35
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Topi Unfollow Follow
    Global Moderator administrators

    Best posts made by Topi

    • RE: read images from a file in C API tool

      Hi,
      The easiest way to read images from files is to set up a virtual camera in the Virtual Camera ribbon of the Builder. You can select the images there. Then, pick your virtual camera from the drop-down list of the Camera Id input parameter of an Image Source tool.

      All images passed between tools must be allocated by the platform. Therefore, you cannot directly return an image that is allocated by an OpenCV function. Otherwise the platform wouldn't be able to correctly deallocate it when it is no longer needed.

      What you can do is to allocate a new output image using for example kuvio_image_alloc_copy and then copying the data from the image allocated by an OpenCV function call. If you place that image to the out struct of your custom tool implementation, you get the picture out.

      posted in Tools
      Topi
      Topi
    • RE: Properly display image source in the browser with JavaScript API

      There is a very good reason for not enabling CORS by default. If you run the Engine on your local machine with CORS enabled, it will let JavaScript code on any web page to make requests to your server. If you are aware of and accept the risk, see here: https://doc.visionappster.com/latest/engine/configuration.html#cors

      Bottom line: if you serve your HTML page from another HTTP server (not from the Engine itself), you need to take care of cross-domain security issues.

      Please note that using a custom server-side script will not be a solution to this problem.

      Media types and image formats are independent. You can handle both compressed and raw images in your application. In both cases, the data type will be Image. The media type only plays a role once you pass an Image through the network. By default, our protocols use a custom binary encoding, which can en/decode any type of an image. It requires a client library (which you are using).

      If mediaType (or the Content-Type request header) is set to image/jpeg the image is encoded as JPEG. This makes it easier to handle the image in many applications, but the encoding may lose data.

      posted in Engine
      Topi
      Topi
    • RE: Where do you get Builder? (for Mac)

      The "VisionAppster" software distribution contains the Builder. The installer will ask you if you want to install a local instance of the Engine as well. All installers are available at https://download.visionappster.com/.

      The fact that you need to ask tells me that we need to improve our message. Thanks for the question!

      -Topi-

      posted in Builder
      Topi
      Topi
    • RE: ARM Docker Image

      We currently have an official Docker image for x86_64 only. For ARM, there is a Raspberry Pi image.

      We however internally build Arch Linux packages for 32-bit and 64-bit ARM. The plan is to publish these and other binary packages in AUR. We'll also provide official Docker images for ARM. They will be built out of the Arch packages and an Arch base image such as this.

      The schedule is still a bit open. If everything goes well, the new binary packages will be included in the next release in May.

      posted in Raspberry Pi
      Topi
      Topi
    • Python API – request for comments

      We are welcoming all feedback related to the upcoming Python API. What kind of an API would you want to see? Which libraries should be included? NumPy and OpenCV will be included, but which other libraries would you like to have?

      Here's a sneak peek of what is coming out:

      import visionappster as va
      
      class Binarize:
          """Binarizes an image using a static gray-level threshold.
          """
      
          def level_min(self):
              return 0
      
          def process(self,
                      inputs: {'image': va.int32,
                               'level': {'type': va.int32,
                                         'min': lambda: self.level_min(),
                                         'max': 255,
                                         'default': 127}},
                      outputs: {'image': {'type': va.Image,
                                          'imageType': 'raw'}}) -> va.int32:
              # Implementation here: read inputs and write to outputs
              return va.SUCCESS
      
      tools = [Binarize]
      
      posted in Tools
      Topi
      Topi

    Latest posts made by Topi

    • RE: Bug in Detect blobs

      Hi,

      Thanks for the reports. To be able to verify and fix issues we need to know the exact steps you took to trigger a bug. Now, I'm not quite sure if I understood your situation correctly. However, here's how I see it:

      1. The sensitivity parameter is documented to have an effect only in the dynamic thresholding mode here: https://doc.visionappster.com/3.0-beta6/tools/detectblobstool/#detect-blobs. Some tools have input parameters that have an optional effect. They don't however disappear to avoid breaking connections.
      2. invert in Find Threshold is an output parameter (function return value). It is calculated from input data and cannot be manually changed.
      3. You mean the Mask Image tool? RGB triplets can represent gray levels, and the tool does the RGB->gray conversion automatically. Did you try it? Is the output incorrect?
      4. This looks like a genuine bug. We were however unable to reproduce it. Can you send us the exact steps?

      BR,
      Topi

      posted in Builder
      Topi
      Topi
    • RE: Downloading and installing python packages offline

      Hmm... Does va-pkg list show that the components are installed? Do you see python:numpy and python:opencv-python there?

      posted in Tools
      Topi
      Topi
    • RE: VisionAppster Engine and python implementation on Windows

      In a local development environment, Python tools are loaded from your plugins/tool directory, which you have correctly done. Such local plugins aren't however automatically included in created packages because there is no reliable way to find out what is actually needed by the Python code.

      To create a package that contains a Python tool you need to copy the *toolplugin.py file to the analysisapp/ directory of your project. See here for an example. The example contains .tool files, but toolplugin.py files work as well.

      One more thing: it is a good idea to register your Python tools with the name of your component as the namespace. That is, if you use "com.acme.python/0" as the namespace, that should also be the full component ID of your component. Importing stuff from other components won't work properly otherwise.

      posted in Tools
      Topi
      Topi
    • RE: Downloading and installing python packages offline

      Disclaimer: I haven't actually tried this.

      1. Download the packages you want to install: pip download pkg-name-here -d output-dir
      2. Copy .whl files from output-dir to the target machine.
      3. On target machine: va-pkg install python:pkg-name-version-whatever-here.whl

      Note that you may need to resolve dependencies manually and install the deepest dependencies first.

      BR,
      Topi

      posted in Tools
      Topi
      Topi
    • RE: Can't access the http://ip-address-of-rpi:2015/ after run visionappster engine

      The flatpak installer contains the Builder although it also gives you an option to install the Engine as a local service if you don't want to fiddle with docker. The Builder is an IDE for creating new vision apps. You don't need it in an embedded environment.

      It is possible to use the flatpak installer in a Yocto-based distro (I know one customer who has done so), but it may be challenging because it basically requires a full desktop environment. If the Builder from the flatpak installation doesn't work, there is little hope that the va-engine service inside it will either.

      My suggestion is to go with the docker image. It is way easier to set up in a custom embedded system. Unfortunately we don't have ready-made installation instructions.

      -Topi-

      posted in Engine
      Topi
      Topi
    • RE: Can't access the http://ip-address-of-rpi:2015/ after run visionappster engine

      Hi,

      Oh, you are using an OpenEmbedded -based custom distro? Making flatpak work on home-grown Linux distributions if unfortunately something we currently cannot help with. Furthermore, flatpak is targeted at desktop and not the best choice if your target is to run the VisionAppster Engine on an embedded system.

      Unless you want to run the Builder on the target hardware, I propose that you use the va-engine docker image instead. It has much lighter dependencies. Basically, you only need a shell and a few utility programs (see here).

      That said, systemctl status va-engine will tell you if the Engine is running. If you use the docker image, the command is docker ps.

      -Topi-

      posted in Engine
      Topi
      Topi
    • RE: Can't access the http://ip-address-of-rpi:2015/ after run visionappster engine

      Hi,

      Can you report your operating system version so that we can try to reproduce the error? What does uname -a output if you type it to your shell?

      When it comes to the connection problem I'm not sure what you are trying to achieve. Are you running a Raspberry Pi with our Engine? Or did you try to connect to a locally running Engine instance?

      When installing with va-install you have the option to install the Engine as a local service. Did you choose that option? If yes, then http://localhost:2015 should do the trick. That is, unless the Engine also fails to start.

      If you are trying to connect to a Raspberry Pi, "ip-address-of-rpi" needs to be replaced with the IP address of the Raspberry Pi. See here for instructions.

      -Topi-

      posted in Engine
      Topi
      Topi
    • RE: Initializing after restart

      @ms I came back to this when running release tests with our new release.

      The simplest thing you can do is to explicitly disconnect the ctrl object on error:

      async function test() {
          let ctrl; // move declaration here
          try {
              const va = typeof window === "object" ?
              VisionAppster :           // Browser
              require("visionappster"); // Node.js
              const inputs = [
              await va.Image.fromUrl('image.jpg')
              ];
              ctrl = new va.RemoteObject("http://localhost:2015/apis/com.myapps.testapp/1");
              const api = await ctrl.connect();
              await api.sendImage.async(...inputs);
              console.log('Success.');
          }
          catch {
              console.error("Failed.");
              ctrl.disconnect(); // add this
          }
      }
      

      It is hard to do this automatically because JS is a garbage-collected language with no destructors. When the app on the server side is brought down, its control channel remains because no one called disconnect() on the client side. The JS runtime can keep the old instance alive arbitrarily long. Since there is a reference to the WebSocket instance, the connection will remain active as well.

      Now, when you create a new RemoteObject instance, it shares an existing connection by default (you are using the default mechanism). This time however the existing connection is defunct. The old server-side object does not exist any more although there is a new one in the same URL.

      The channel sharing mechanism could be improved to take the remote object ID into account, but that would be a rather invasive change now. The work-around is quite simple and I hope it will work for you for the time being. We'll come back to this during the next release cycle.

      -Topi-

      posted in Engine
      Topi
      Topi
    • RE: Properly display image source in the browser with JavaScript API

      There is a very good reason for not enabling CORS by default. If you run the Engine on your local machine with CORS enabled, it will let JavaScript code on any web page to make requests to your server. If you are aware of and accept the risk, see here: https://doc.visionappster.com/latest/engine/configuration.html#cors

      Bottom line: if you serve your HTML page from another HTTP server (not from the Engine itself), you need to take care of cross-domain security issues.

      Please note that using a custom server-side script will not be a solution to this problem.

      Media types and image formats are independent. You can handle both compressed and raw images in your application. In both cases, the data type will be Image. The media type only plays a role once you pass an Image through the network. By default, our protocols use a custom binary encoding, which can en/decode any type of an image. It requires a client library (which you are using).

      If mediaType (or the Content-Type request header) is set to image/jpeg the image is encoded as JPEG. This makes it easier to handle the image in many applications, but the encoding may lose data.

      posted in Engine
      Topi
      Topi
    • RE: Properly display image source in the browser with JavaScript API

      Sorry, but I don't quite get what you are trying to achieve. You only need server-side (e.g. Node.js) code if your application requires image processing in the back-end.

      Drawing pixels on the canvas in the browser requires careful handling of different RGB types and endianness. Please see the Image.toImageData() function. I'd however recommend using <img> instead. The cookbook recipe you are referring to uses <canvas> and toImageData(). Please let me know if that solves your problem.

      posted in Engine
      Topi
      Topi