iCarousel index number of starting image to display - ios

I am implementing the API, and i am comparatively new when it comes to use API in ios.
I can understand that the sample images are taken in a dictionary and when fetched, it comes arbitrarily, and when the program is runned, the image at index 1 is displayed as the front image.
I want to make any desired image as the front image one.
How do i achieve this?

If you have read the documentation, it says if you want to set the current index (which in turn sets the image first), you will need to set the currentItemIndex.
So, lets say you have 10 images in your iCarousel and want to set the third one as the front image. You might have to have something like:
[self.carousel setCurrentItemIndex:3];

[self.carousel setCurrentItemIndex:3];
setCurrentItemIndex is set the starting value of Cover Flow.

Related

Close an image with Gimp Script-Fu

Stoopid question time. How do you close an image in GIMP with Script-Fu?
Sort of the Pythonic version of this: (ignore changes and close)
// close the image WITHOUT saving
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
There's nothing in the Python Procedure Browser for "close"
(You title & tag "script-fu", which is Scheme/Lisp, but then mention Python..., so going for Python...)
The theory is that a script shouldn't interfere with the UI, so you can't close an image at random.
If your script loads an image, the image can be shown to the user using a display=gimp.Display(image) (this is a gimp.Display object). You can also add a display to an already loaded image the same way. Since you created the display, you know it, you own it and so you can close it with gimp.delete(display). When the last display of an image is closed, the image is quitted.
If you don't create the display, you can take advantage of the fact that the display IDs are created in sequence and that this sequence sort of matches the image ids so unless many images have been loaded without a display or many images have go many displays, the display ID and the image ID are close to each other.
And given an integer ID, you can recover the display using the "secret" gimp._id2display(id), so if there is a single image loaded, you can find its Display with something like
for displayID in range(1,image.ID+50):
display=gimp._id2display(displayID)
if isinstance(display,gimp.Display):
break
if not display:
raise Exception('Display not found')
gimp.delete(display)
But this will misbehave if there is more than one image loaded, so beware.

ARToolkit Multiple Mandatory Markers

I studied the multimarker documentation of ARToolKit for iOS and i have some troubles in achieving some sort of QR-Code.
I want, for example:
A set of 6 markers positioned differently on a picture, and when and only when ALL of them are present, some sort of video is displayed in the origin of them( i want to use some sort of CORNER Markers like QR-Code system ).
How to do this ? From what i've seen, on multimarkers, if 1 is present out of 6 for example, the object is displayed.
From looking into the ARToolKit code you can see that a MultiMarker is internally handled as one single Marker consisting of several Pattern:
https://github.com/artoolkit/artoolkit5/blob/master/lib/SRC/ARWrapper/ARMarker.cpp#L344
https://github.com/artoolkit/artoolkit5/blob/master/lib/SRC/ARWrapper/ARMarkerMulti.cpp#L75
That is why ARToolKit will always return true whenever one of the markers configured in the multi-marker configuration is visible.
Taking that into account ‘Multi-Markers’ are not the way to go for the target you would like to reach.
What you can do, however, is to configure each marker separately and add them as ‘Single-Marker’. Then you can query if all of these ‘Single-Markers’ are visible.
If so you can calculate the origin of all these ‘Single-Markers’ and render your object there.
You can get an idea on how to configure several ‘Single-Markers’ if you take a look here:
http://augmentmy.world/moving-cars-augmented-reality
Also take that example here on how to set to markers into the same coordinate system (and calculate the distance between them) you can use that as a starting point for calculating the origin between several markers:
https://github.com/artoolkit/artoolkit5/tree/master/AndroidStudioProjects/ARMarkerDistanceProj
I know that these are not iOS examples but I have only done Android so far. Also, the ARWrapper interface should be the same on Android and iOS, meaning to say there should not be much difference between these two.
I hope that helps

How to show a specific amount of images based around a changing Int?

I'm currently working on an app that retrieves rewards points from a server. Depending on how many rewards points available, that many images will show up on the home screen. So if the server returns 5, there should only be 5 images shown. I can retrieve that data ok and have the images set up but am not sure how to only make the total number of images appear based on the number received. Any thoughts?
if n is the points retrieved from server:
go through a loop:
for i in 0...n {
// Create one image here
}
This will give you required number of images.
I don't know about your UI layout or how you'd like the images to appear, but you could set up all the images to display and then when a lower number comes in from the server, set some of the images to hidden.
If you are using UIImage then it's really just as easy as
myImage.hidden = true

Full width image strategy

I wanted to present the user with a screen shot of my app while it's in use, and then create a black overlay on it, and then create coach marks on the screen, similar to something like this, when the user first registers:
So I created the image and I want to make sure that no matter who uses it, it always fits nicely on their iphone4/iphone5/ipad mini/ipad, etc. What is the best approach to do this these days? Just take one giant image (make it like 1297 x 2208), add this to my asset catalog for all 3 sizes, and then just have autolayout resize it for me normally? I.e. put an imageview on the page, set it to always take up the entire screen width, and then set it's image to my giant image? Would it always resize down and look good?
Another thought that popped into my head is create lots of different images, then use all of the size classes to make the image (seems like a lot of tedious work for just a full page image so thinking this is the wrong approach).
What's the right strategy for creating a giant image that always fits? is it to go really high, and have it resize, or is it to create lots of images with different dimensions, and somehow detect which to use?
Thank you in advance!
I wouldn't take a screenshot of your image, just let the real UI show through. This lets you have some future changes to the UI w/o having to redo your "screenshotted" UI.
I'd also make different help images for each screensize, it isn't that much work and it lets you not squish or stretch your overlay.
I've also code up, but can't share the code, for a three part approach, top, middle and bottom, this way I could handle the 3.5" and 4" devices easily without stretching.

Whats the best way to check whether one image is somewhere on/similar to another image?

I want to use openCV to check whether an image is somewhere on another image. This other image could also be a photo. I dont want to know the position or anything, I just want to know whether the image is there or not - or, if the images are "equal enough".
Example: I use my iphone to take a photo of a static object. Now, one day later I take this photo again and I want to check if it is the mostly the same object.
Whats the best way to do this? I alos tried CVMatchTemplate (but was not able to get a working check) and CVNorm.
Maybe SURF (Speeded Up Robust Features) can to this.
I used it to check if an template image can be found on objects along an moving conveyor belt.
Have a look on this page, it describes the usage of SURF with the EMGU-OpenCV wrapper classes.

Resources