Automatic background removal from still image without user interaction - image-processing

I am trying to develop an image search application. I have crawled through e-commerce websites and obtained some data set of images(~2.5 Million). Now I want to identify the object of interest from each image so that when i do a feature comparison on large scale the results will be accurate(generally there is only one object of interest in each image). I went through grab cuts and graph cuts but that require user interaction of some sort. Is there any way where i can remove the user interaction aspect and do this automatically.
Thanks in anticipation.

Related

Cropping multiple images in react native

What would be the right approach to crop several images at ones in React Native? I'm working on an app where user selects many photos but before uploading them to the server, each photo should have the right aspect ratio - 1:1, 2:3, etc.
I'm using react-native-image-crop-picker to allow user to select multiple photos at ones. Initially I used to same library to allow users to crop one photo at a time but it was a bad user experience as people upload 10-20 photos at a time. So I thought of auto-cropping images behind the scene using ImageEditor.cropImage()
Now I get the cropped image but it almost freezes the app until the images are cropped, leading to bad ux.
Any leads on how this should be tackled?
In my opinion this seems like a very difficult scope to cover only by using the react-native-image-picker library. I would rethink this lack of flexibility on the server side when receiving images too. Basically I think it's just not a good UX demanding the user to upload multiple images with a restricted aspect ratio on a mobile device.
But if that's not possible you could try to solving this problem with the following options for better UX:
Option 1: Once importing the images, show them in a grid view in your app, allowing the user to crop every single one of them before uploading (this way the user can do it manually without feeling too overwhelmed, a slightly better approach to the manual cropping)
Option 2: Try to run the automatic cropping images sequentially (not asynchronous), and show the user an ActivityIndicator while the app is busy processing those images and uploading them (lock the app's navigation if you need to, it's understandable from the user's side that uploading multiple images is a slower process).
Option 3: Move the automatic cropping functionality to the server side if possible, this way the app is not overwhelmed with the processing of the images, and the Backend will have more liability by treating all the images that it receives. Not sure if that could be implemented though.

Is it possible to remove the common background from a set of images using Photoshop?

I know you can remove people, cars, etc in the foreground of a stack of photos taken from a set position - essentially only KEEPING the common background. But my problem is the opposite of that...
I have 90 images of football players, all taken from a tripod in a set location. Is it possible to use a stack (or some other method) to process these photos and automatically REMOVE the common background in them - leaving behind layers containing only the players (and whatever other minor background changes there may have been)?
Since CC2018 Photoshop has a Select Subject functionality which isn't ideal depending on the subject and background, but may produce decent results and can be automated using this AM command:
executeAction(stringIDToTypeID('autoCutout'), undefined, DialogModes.NO);
This might work depending on the files you have.

A-Frame & ar.js: Multiple markers & boxes

Is there any proof of concept of how to implement multiple AR markers w/ A-Frame?
Ex. Something like this: https://www.youtube.com/watch?v=Y8WEGGbLWlA
The first video in this post from Alexandra Etienne is the effect I’m aiming for (multiple distinct AR "markers" with distinct content): https://medium.com/arjs/area-learning-with-multi-markers-in-ar-js-1ff03a2f9fbe
I’m a bit unclear if when using multiple markers they need to be close to each-other/exist in the same camera view
This example from the ar.js repo uses multiple markers but they're all of different types (ie one is a Hiro marker, one is a Kanji marker, etc): https://github.com/jeromeetienne/AR.js/blob/master/aframe/examples/multiple-independent-markers.html
tldr: working glitch here. Learn the area (the image is in the assets), click the accept button, and toggle the marker helpers.
Now, a bit of details:
1) Loading saved area data
Upon initialisation, when ar.js detects, that you want to use the area marker preset, it tries to grab a localStorage reference:
localStorage.get("ARjsMultiMarkerFile")
The most important data there is an array of pairs {markerPreset, url.patt} which will be used to create the area.
Note: By default it's just the hiro marker.
2) Creating an area data file
When you have debugUIEnabled set to true:
<a-scene embedded arjs='sourceType: webcam; debugUIEnabled: true'>
There shows up a button "Learn-new-marker-area".
At first glance it redirects you to a screen where you can save the area file.
There is one but: by default the loaded learner site is on another domain.
Strictly speaking: ARjs.Context.baseURL = 'https://jeromeetienne.github.io/AR.js/three.js/
Any data saved there won't be loaded on our website, for local storage is isolated per origin.
To save and use the marker area, you have to create your own learner.html. It can be identical to the original, just keep in mind you have to keep it on the same domain.
To make the debugUI button redirect the user to your learner html file, you need to set
ARjs.AnchorDebugUI.MarkersAreaLearnerURL = "myLearnerUrl.html"
before the <a-marker>s are initialized. Just do it in the <head>.
Once on the learner site, make sure the camera sees all the markers, and approve the learning.
It should look like this:
Once approved, you will be redirected back to your website, the area file will be loaded, and the data will be used.
As #mnutsch stated, AR.js does what you want.
You can display two different models on two different markers. If the camera doesn't see one of the markers the model vanishes (or stays where it was last, depending on your implementation.
The camera doesn't need to see both.
Screenshot:
https://www.dropbox.com/s/i21xt76ijrsv1jh/Screenshot%202018-08-20%2011.25.22.png?dl=0
Project:
https://curious-electric.com/w/experiments/aframe/ar-generic/
Also, unlike Vuforia, there is no 'extended tracking' - once the code is out of sight, you can't track anymore.

How can I get the position of an identified object in Scikit-Learn?

I can use Scikit-Learn to train a model and recognize objects but I also need to be able to tell where in my test data images the object is residing. Is there someway I could maybe get the coordinates of the part of the test image which has the object I'm trying to recognize?
If not, please refer me to some other library that'll help me achieve this task.
Thankyou
I assume that you are talking about a computer vision application. Usually, the way that a box is drawn around an identified object is by using a sliding window and running your classifier on each window as it steps across the screen. You can keep track of which windows come back with positive results and use those windows as your bounds. You may wish to use windows of various size, if the object scale changes from image to image. In that case, you would likely want to prefer the smaller of two overlapping windows.

How to apply Core Image filters one at a time to save memory consumption?

When you apply a number of Core Image filters to an image, memory can quickly become a limiting factor (and often leading to a crash of the application). I was therefore wondering what a good approach is to add one filter at a time and wait for each operation to complete.
The example that I am working on involves one photo to which the user can apply various effects/filters. The user is presented with a small thumbnail to get an idea of what each filter looks like. When all the filters are applied at one, the application runs out of its assigned amount of memory and crashes.
In short, how do I go about applying one filter at a time and be notified when the operation is complete so I can apply the next filter to the next thumbnail?

Resources