Hey guys i try to implement a camera:
A photograph is a kind of thing. 36 photographs are in the film roll.
Appearance relates one thing to various photographs. The verb to be shown by means the appearance relation.
The description of a photograph is usually "It shows [a random thing which is shown by the item described]."
Understand "of [something related by reversed appearance]" as a photograph.
This allows the player to refer to any photograph by its subject: useful if we have a large number of them.
Now we create an action to let the player use the camera and generate these photograph objects:
The player carries a cheap instant camera.
Understand "photograph [something] with [camera]" as photographing. Understand "photograph [something] with [something preferably held]" as photographing. Photographing is an action applying to one visible thing and one carried thing, requiring light.
The photographing action has an object called the selected film.
Setting action variables for photographing:
let N be a random photograph in the film roll;
now the selected film is N.
Check photographing:
if the second noun is not the camera, say "You need a camera for that purpose." instead.
Check photographing:
if the noun is the camera, say "Sadly impossible." instead.
Check photographing:
if the selected film is nothing, say "You're out of film." instead.
Carry out photographing:
now the noun is shown by the selected film;
move the selected film to the player.
Report photographing:
say "Your camera instantly spits out [a selected film]."
Like in Example 322:
http://inform7.com/book/RB_9_12.html
In the example there is only one camera with one film roll.
but i want two different cameras and both cameras should have a individual film roll.
So i can take pictures with camera#1 saved to filmroll#1 and i can take pictures with camera#2 which are saved to "filmroll#2".
Can somebody help me?
I think you could do this with aliases. It's been a while since I coded in Inform 7, but I believe the syntax is something like:
The player carries a first camera.
The printed name of first camera is "cheap instant camera".
There is a second camera in the lab.
The printed name of second camera is "cheap instant camera".
You would have two cameras that display as the same thing, but are distinct. And you could do the same thing with the rolls of film. You might still have issues knowing which camera is which, but hopefully this gets you on the right track.
Related
I have a heal [someone] action that restores an hp value I have given all people in my story.
When I enter the command heal on it's own it defaults to healing anyone else in the same room before it does the player.
Is there a way I can make that action default to the player if no noun is specified?
You can create another action ("healing oneself" in this example), understand the phrase "heal" as that action, and convert the action to the healing action applied to the player in a Check rule:
A person has a number called current hit points.
A person has a number called maximum hit points.
Healing is an action applying to one thing.
Healing oneself is an action applying to nothing.
Understand "heal [someone]" as healing.
Understand "heal" as healing oneself.
To appear is a verb.
To feel is a verb.
Check healing oneself:
convert to the healing action on the player.
Carry out healing:
now the current hit points of the noun is the maximum hit points of the noun.
Report healing:
if the noun is the player:
say "[We] [feel] completely healed!";
otherwise:
say "[The noun] [appear] completely healed!".
Does the player mean healing the player: it is likely.
ยง17.19. Does the player mean...
I try to list possible directions to which the user might go. But for the tone of the story it would be nicer not to say "you can go north and south" but "you can go to the bathroom and the kitchen".
I found hat code but it only shows the directions.
Definition: a direction (called thataway) is viable if the room
thataway from the location is a room.
After looking:
say "you can go [list of viable directions]."
Any idea?
Absolutely not the nicest way of doing it, but I had a similar problem and I ended up iterating over the list of directions you created and added each of the rooms to a list of rooms, one could then say:
nLooking is a number that varies. nLooking is 0.
After looking:
now nLooking is 1;
let accessibleRooms be a list of rooms;
let pDirections be list of viable directions;
repeat with dirToLookAt running through pDirections:
try silently going dirToLookAt;
if rule succeeded:
add the location of the player to accessibleRooms;
try silently going the opposite of dirToLookAt;
now nLooking is 0;
say "You can go to [accessibleRooms].".
Before going through a locked door when nLooking is 1:
stop the action.
I used nLooking to block the output
(first opening door)
It seems to be locked.
when looking for the rooms one could access.
if rule succeeded checks if the palyer was able to go to the room. If that is the case the room the player walked in is added to the list and the player is moved back to where he came from.
This works only if one does not make a chaotic map where moving in the opposite direction of where one came from does not mean one lands in the same room. One could possibly just place the player back in the room he came from...
Late answer I know but maybe it helps people with the same problem :)
i wana to make simple plugin in sketchup, but first of all i need to understand how sketchup works. So i played with faces, shapes, groups and layers as little kid, but there is something that blows my mind.
Is here even posible, to have one face in two groups? Or probably layer, but group will be much better. For example, i have a house which i wana to split into two zones (house + garage for example) and i know, that between this two rooms is only one wall, but it belongs to house (living part) and to garage. I would like to have garage and house (living part), but im not able to click this one in sketchup. If needed i can provide image, but i think its enough explained.
If you add a face in a ComponentDefinition and place ComponentInstances in the model that face will exist in several places in the model. Groups are like component instances - but they are made unique when you edit them.
For more details you can read this article: http://www.thomthom.net/thoughts/2012/02/definitions-and-instances-in-sketchup/
I will create a biped robot soon, i will add speech recognition and stuff to it.
I want it to find in my house. Is it possible to create like a map or something where i mark the
places in the house with numbers or something and then make the arduino robot
read it, so ex. when i say: "Go to your room" (the arduinos room = my room) it will go
to it's room (my room) automaticly.
UPDATE:
Is there a gps module or something that i can modify like i want so my robot
can find in my house? So i can mark where it can go and where the rooms are
and so i can program it to go to ex. my room when i say so, and it will find to my room.
There are many different ways of attacking this scenario. If you are talking a map it might be worth generating a measurement system whereby you can use an array of units to allow your robot to navigate the house. I think you will run into issues over time with unexpected variance so the large part if navigation code would have to tackle calibrating against a known map.
The advantage of using this method is that you could have it "learn" a new space by mapping a new array against your units
We need to build a model of the shop floor in which we can relate pixel coordinates(x, y) from
camera images to the actual objects in the 3D space of the store. The camera images, which will act as sources for generating such a model, suffer from fish-eye distortions. Hence straight lines actually appear as curves in the camera images and the walls appear to meet each other at not exactly right angles.
We are sub-dividing the region into polygons. Each polygon on the image refers to a particular region such as a shelf, display area, checkout counter etc. By mapping the pixels that fall in each polygon, we want to relate it as belonging to the shelf corresponding to that region.
Any ideas how to go about it?
Following is a sample image of the store with some polygons marked:
EDIT:
We are not looking to find out the 3D coordinates, we just need to know which shelf is any polygon mapped to. So if the user clicks on a polygon, we can say he clicked on which shelf.
We are able to manage the above for big polygons like the ones shown in the image, but the shelves away from the camera can be as small as a few pixels so we need some kind of a probabilistic result saying if the user clicked at (x,y) what is the probability that he was trying to click on Shelf-A or what is the probability that he was trying to click on Shelf-B and so on.
Basically, what we are looking for is a probability function which would return the probabilities of click on nearby objects when a small polygon(or a pixel) is clicked on the 2D image.
EDIT2:
One thing which is not apparent from the sample image is that the polygon size could be really small(as small as a few pixels) and polygons in turn could be really close to each other.
Moreover, the use case is that a customer in the store picks a product from one of the shelves. The application user would click on a point in the image from which he thinks the products is picked up. Now since the polygons are so small and so close, the user can only guess the exact point of pickup, so we can only know at best that it could be any one of the 3-4 polygons close to the point of click. So the question is how to calculate probabilities for these 3-4 polygons given the click?
As suggested here distance of the click from the center of polygon and its area could be parameters in calculation of this probability, what I am wondering is if there is algorithm to do so.
We are not looking to find out the 3D coordinates, we just need to know which shelf is any polygon mapped to. So if the user clicks on a polygon, we can say he clicked on which shelf.
I assume you have a mapping from polygon to shelf name. For example, as a list of pairs (polygon, shelf name). You can make it by hand once, if the cameras are fixed and don't move. Then your problem is only finding which polygon does a point belong to.
If you use OpenCV, then you can use its PointPolygonTest function. Otherwise you may write a similar function yourself. See, for example, a Ray casting algorithm. Then look through the list until you find a polygon which the point lies withing.
To further optimize the program you may precalculate polygons' extents. An extents allows you to quickly say when the point is definitely not inside the polygon, and consider only the remaining polygons. But with so few polygons as you have in the image, I would not bother.
Basically, what we are looking for is a probability function which would return the probabilities of click on nearby objects when a small polygon(or a pixel) is clicked on the 2D image.
Just run an experiment, try to click a single highlighted pixel, accumulate some statistics on where the operator does actually clicks. Once you have this, it's easy to predict the number of out-of-object clicks and how far they are likely to be off.
Without such experiment with exactly the same kind of person, the same usage conditions and the same pointing device you are going to use, you cannot really tell how much off the clicks are going to be. I believe that many people are sniper clickers if the mouse is good and they can see the image well. If they are forced to use touch interface or some other pointing device, the precision may be lower.
Few comments
fish eye can be corrected by applying some transformations to the image, see for example this page for some resources including panotools
to get the 3D coordinates only and image from one camera is not enough, additional info is necessary
marking a same point on two images of the same scene from different cameras can give you full 3D info (you do need to know position of each camera relative to each other)
if you are looking for tools to do it, see https://superuser.com/questions/30053/is-there-any-free-open-source-software-that-converts-photos-to-3d-models
EDIT
After update to the question, assuming there already exist a set of polygons and you want to eliminate user errors (or improve precision) you might
try to guess the desired click polygon by calculating distance to centre of weight of polygons close to click
use visual cues (flash the polygon selected and require second click)
collect statistics on errors and for certain polygons require validation
What you want is a space-filling-curce for example a Z-Curce or a Hilbert-Curve. A space-filling-curve sub-divide the plane into smaller tiles and reduce the complexity of 2-Dimensions into 1-Dimension in a way that each tile get's a new order. What might interessting for your problem is that the Hilber-Curve traverse the plane not in binary order but it use a gray code so that every tile is different in 1-Bit from the other tiles. That makes it easy to decide whether the user has clicked this or that object.