QGIS/GRASS Watershed Analysis output cell size issues - gis

Gooday,
As my first post I offer a humble apology if this is such a basic question as to make any of you cringe. I feel like I have exhausted my search skills and read through the QGIS documentation frequently and thoroughly.
My problem is with any of the hydrology analysis in GRASS through QGIS. I have a GRASS mapset that uses a 30m resolution DEM for my area. The extent of the mapset is set to include only the DEM (ie. no whitespace or no-data areas) and yet when I run r.fill.dir, r.basin or r.watershed I get back an image that has a resolution of nearly 73xxmetres. I am most used to ArcGIS where in the hydrology tools the user can define the working environment and set the output resolution to match the input resolution. Is there anyway to set that in GRASS or am I missing a basic step somewhere? I feel like I set up GRASS correctly as other non analytical map work is working fine.
Any help would be much appreciated.
Sincere regards,
Grant McGee

Related

Trouble identifying patches of habitat in ArcMap

I’m having some trouble identifying patches of habitat. Ive had some help with this issue before but I cannot get anything to work.
I downloaded the Arcgrid (zipped) from this website http://www.kew.org/gis/projects/mad_veg/datasets_gis.html. I’ve managed to open the data in ArcMap 10.1 and it displays all the habitat types in Madagascar. I wanted to determine how much of a specific habitat there was (humid forest) and I found that just with the number of pixels. But obviously that’s the total area that area and in reality is broken and fragmented into thousands of little forests. I need to find a way to determine how many patches of forest there are and what size they are.
If it helps ill just explain what it is I’m trying to do. I am studying a species of lemur, and a community needs a minimum 4km2 of forest. I’m trying to how much viable habitat I left in Madagascar. The overall area doesn’t give me that because I could be made of patches too small to support a community. I need a way to find out how much littoral forest there is left in patches over a certain size.
I’m no expert in GIS and someone suggested I run a code python such as
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "Q:\Veggrid"
inZoneData = "vegetation"
zoneField = "Value"
outTable = "zonalgeomout02.dbf"
processingCellSize = 29
arcpy.CheckOutExtension("Spatial")
outZonalGeometryAsTable = ZonalGeometryAsTable(inZoneData, zoneField, "AREA", processingCellSize)
However each time I run this code ArcMap loads for a while and just crashes. I tried making the cell size smaller but it didn’t make a difference. Like I I’m not expert and Im not sure what to do. People have suggested downloading various packages but it’s a university computer and it doesn’t seem to allow it
Any help / advice would be greatly appreciated
This code works fine.
Try to increase processingCellSize (For example: 1000).

How can I analyze live data from webcam?

I am going to be working on self-chosen project for my college networking class and I just had a couple questions to help get me started in the right direction.
My project will involve creating a new "physical" link over which data, in the form of text, will be transmitted from one computer to another. This link will involve one computer with a webcam that reads a series of flashing colors (black/white) as binary and converts it to text. Each series of flashes will simulate a packet of data. I will be using OSX an the integrated webcam in a Macbook, the flashing computer will either be windows or osx.
So my questions are: which programming languages or API's would be best for reading live webcam data and analyzing the color of a certain area as well as programming and timing the flashes? Also, would I need to worry about matching the flash rate of the "writing" computer and the frame capture rate of the "reading" computer?
Thank you for any help you might be able to provide.
Regarding the frame capture rate, Shannon sampling theorem says that "perfect reconstruction of a signal is possible when the sampling frequency is greater than twice the maximum frequency of the signal being sampled". In other words if your flashing light switches 10 times per second, you need a camera of more than 20fps to properly capture that. So basically check your camera specs, divide by 2, lower the resulting a little and you have your maximum flashing rate.
Whatever can get the frames will work. If the light conditions in which the camera works are gonna be stable, and the position of the light on images is gonna be static then it is gonna be very very easy with checking the average pixel values of a certain area.
If you need additional image processing you should probably also find out about OpenCV (it has bindings to every programming language).
To answer your question about language choice, I would recommend java. The Java Media Framework is great and easy to use. I have used it for capturing video from webcams in the past. Be warned, however, that everyone you ask will recommend a different language - everyone has their preferences!
What are you using as the flashing device? What kind of distance are you trying to achieve? Something worth thinking about is how are you going to get the receiver to recognise where within the captured image to look for the flashes. Some kind of fiducial marker might be necessary. Longer ranges will make this problem harder to resolve.
If you're thinking about shorter ranges, have you considered using a two-dimensional transmitter? (given that you're using a two-dimensional receiver, it makes sense) and maybe have a transmitter that shows a sequence of QR codes (or similar encodings) on a monitor?
You will have to consider some kind of error-correction encoding, such as a hamming code. While encoding would increase the data footprint, it might give you overall better bandwidth given that you can crank up the speed much higher without having to worry about the odd corrupt bit.
Some 'evaluation' type material might include you discussing the obvious security risks in using such a channel - anyone with line of sight to the transmitter can eavesdrop! You could suggest in your writeup using some kind of encryption, a block cipher in CBC would do, but would require a key-exchange prior to transmission, so you could think about public key encryption.

How to begin with augmented reality? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm currently an undergrad in computer science and I'll be entering my final year next year. Augmented reality is something I find to be a really interesting topic, but I have no idea where to start learning about it.
Where do you start learning about this topic and what libraries are available?
Being a quite popular buzz word, augmented reality can be build with some distinct algorithms which can be learnt separately. Usually it covers:
planar object detection (can be a marker or previously trained object).
SURF/SIFT/FAST descriptors, RANSAC for homography matrix calculation
store trained objects in DB (KD-trees)
camera position estimation
augmenting 3D model with custom objects (OpenGL)
To dive into this subject I would recommend this steps:
All of this is already implemented in OpevCV, you can start playing with its examples.
To understand what's happening under the hood, take probably the best book on this topic:
"Multiple View Geometry in Computer Vision" http://www.robots.ox.ac.uk/~vgg/hzbook/ .
If you are going to play with AR on mobile phones take a look on works of scientific labs
like http://mi.eng.cam.ac.uk/~sjt59/hips.html (FAST) and http://www.robots.ox.ac.uk/~gk/PTAM/ (PTAM).
If you're comfortable with Objective-C, downloading and playing with ARKit would be great place to start. It's based on magnetometer/accelerometer readings rather than pattern recognition.
If pattern recognition is what you're interested in, then start with artoolkit instead. But that library is a bit more intense, naturally.
Take a look at this augmented reality framework comparison table to select a suitable AR framework for your work.
qualcomm's vuforia AR api is a great place to start since it is free and it has all the AR features we can think of.
And also this book gave me a huge help to start building AR apps.
Developing AR Games for iOS and Android
by Dominic Cushnan, Hassan EL Habbak
Ben Newhouse, the man behind Yelp's augmented reality Monocle feature, gave a talk at Stanford about the process he went through when making it. It is available for free on iTunes U, at this location: https://podcasts.apple.com/us/podcast/iphone-application-development-winter-2010/id384233225
(The link won't work in Chrome, but it does in Safari. If it doesn't work, just search "Yelp Monocle" in iTune's search box, and download the iTunes U lecture.)
The lecture is about programming for the iPhone, but most of it is translatable to other areas. It is packed with valuable information, and has proved extremely useful for me in seeing all the components of what i want to make.
The Pragmatic Programmer AR book is pretty good, lots of code samples and exercises that get you involved, instead of just reading about it. It is a little dated, but it should be a pretty good starting point.
This was extremely helpful to me because of the step by step tutorials and sample code: http://dev.metaio.com/sdk/getting-started/
It takes you from setting up your phone/ dev account through to tracking configurations and 3D content.
I have spent a bit of time looking for AR code for the iPhone. If you want to do AR and locations then download this project
http://github.com/adascent/iPhone-AR-Toolkit
It based on ARKit mentioned above but improved and actually compiles. The orginal AR kit does not support device rotation. Someone else added it but there actual code never worked and so a 3rd person took it and fixed it.
I am currently added more features to this code.
augmented reality is combination of 2 skills: ability to code on smartphones + using all the input sources that the handset can provide to provide interesting applications. Computer vision is a major aspect, since the camera can be used in very many interesting ways. But you must know that knowing any one aspect of it is not good enough. for example if you use comp vis, alone to detect where you are based on the camera input of a shopping mall store it is not going to be easy at all. but if you couple up your gps location etc, the problem reduces to a very managable level. So the important thing is being able to couple ideas from different aspects and knowing a little bit about both aspects. Take a smartphone programming class and a computer vision class. that should get you started.
If you're an undergrad, you start by asking faculty about it (or grad students, if you're in a place with them). Even if they don't know much about it, they'll know where to find out.

Simulating engine noise in Flash 10

I'm working on a "retro" motorbike game in flash, similar to the Road rash series on the mega drive and after having a long play with the sound sampling capabilities of flash I can't manage to find the "right" way to generate the noise.
I've been trying to basically change the frequency on a sine wave in line with the revs, so as the revs increase so does the frequency - it sorta works but sounds nothing like a real engine (I've been a biker for a while and I ride to work on my bike every day so I "know" what it should sound like :-p).
I'm not so much after a realistic sound, just somthing that sounds "okay", or good enough that most people playing the game wouldn't notice and be happy that the sound actually relates to the revs and speed as apposed to just a flat mp3.
I can't seem to search on google as I can't find the right words, "engine" just dilutes all of the results with game engines and what not.
The majority of articles I find also suggest using sampling - but there are 2 major issues with this:
Even though I have a bike and could record the sounds; recording samples of the rpm - say 15 if I do samples at 1000 intervals (my gsxr revs all the way to 16k :-p) I'd then have to also sample each one at various loads, i.e. 0mph, 10mph, 20mph, 30mph, 40mph as the engine noise varies greatly depending on load - which totals a whopping 80 samples - although I'm not sure if the load can be simulated somehow on top of the rpm samples?
All those samples add up to bytes that have to be downloaded before you can play.
One way I've found uses a mix of sampled engine sounds and synthesized tones. Get samples of an engine at a couple of different RPMs and use those for the base. Mix two samples based on the current RPM, e.g. if it's 1650 RPM, play a sample taken at 1500 RPM at 70% volume and a 2000 RPM sample at 30% volume. Modify the overall volume based on the throttle. Add a sine wave tone based on the RPM like you've done.
The technique is described in the paper Design of a Driving Simulation Sound Engine (PDF), which is about synthesizing engine (and other driving-related sounds) for a driving simulator. I found it by searching for sound synthesis "engine sound" (with "engine sound" in quotes. Motor sound effect synthesis has some discussion of synthesizing motor sounds in general, with instructions for the Pure Data environment.
Sonoflash have a library of code-based sounds (some for free), and may have something appropriate for you, or at least a starting point. Their 'machine propeller', for example.
I've tried Sonoflash as well, it's really good!
http://www.sonoflash.com/sounds/#EngineLight
This might be a sound you are looking out for.

Solar system computer model

I'm interested in building a 3D model of our solar system for web use (probably with AS3 and papervision) and have been looking into how I would go about encoding the planetary positions. My idea was to download the already calculated positions from NASA as calculating the positions myself seems a but overcomplicated. I'm not sure though whether I should use a helio centric or an earth centric encoding.
I wanted to know if there are any one with any experience in this. Which approach would be better? The NASA JPL website seems to have the positions of all the major bodies in our solar system as earth centric. I can see this becoming a problem later on though when adding Voyager and Mars Lander missions to the model?
Any feedback, comments and links are very welcome.
EDIT: I have a rough model running that uses heliocentric coordinates, but I haven't been able to find the coordinates for all planets in this format.
UPDATE:
I don't have a lot of detail to provide for know because I really don't know what I'm doing (from the space point of view). I wanted to get a handle on 3D programming, and am interested in space. The idea was that I would make a rough solar system simulator with at first all the planets and their orbiters (maybe excluding satellites at first). Perhaps include a news aggregator and some links to news/resources and so on. The general idea would be to allow people to click around and get super excited about going to the moon and Mars (for a starter).
In the long run I hopefully would be able to add in satellites and the moon missions (scroll back in time to the 70's and see the moon missions).
So to answer Arrieta's question the idea was not to calculate eclipses but to build an easy to approach, interactive space exploratorium, and learn some 3D and space related stuff on the way.
Glad you want to build your own simulator, but depending on what you want to do it may be far from an easy task. The simplest approach is as follows:
Download the JPL-DE405 ephemerides and the subroutines for retrieving the planetary positions (wrt Solar System Barycenter).
Request for timespan, compute the positions, and display them to the screen in a visually appealing manner
Done
Now, why would you want to do this? If you want to view the planet's orbits, that's it. You are done. If you want to compute geometric events (like eclipses, or line-of-sight, or ilumination) then you are in a whole different ball game. That's astronautics, and it is not simple.
Please be more specific. The distinction you make of "geocentric" or "heliocentric" coordinates really has no major difficulty involved. If you have all the states in heliocentric frame, you can compute the geocentric frame by simple vector subtraction. That's not the problem! The problems are a thousand more, but you need to be specific so we can provide more guidance.
JPL has provided high quality ephemerides for decades now, and we have a full team of brilliant people working on it. It is one of the most difficult things to get right!
Again, provide more details or check out other sources of information.
Please google "Solar System Simulator" (done here, at JPL) and see if it fulfills your needs.
Cheers.
It may be worth you checking out the ASCOM Platform (we also have a stack exchange site called ASCOM Answers).
The ASCOM Platform has several useful libraries for doing this sort of thing.
USNO NOVAS (Naval Observatory Vector Astrometry)
Kepler orbit engine
The USNO/NOVAS stuff was originally written in C and we've wrapped it up in .NET for ease of use from C# and VB.
As an added bonus (actually it's the raison d’être for ASCOM), the Platform makes it easy for you to control things like telescopes, it's used by Microsoft's World Wide Telescope for exactly that purpose. I tmight be a fun extension to your model to be able to point a telescope at things.
I'd probably start (well, I did a while back) with heliocentric coordinates and get a few of the planets up and running. But sooner or later you'll want to write a heliocentric-to-geocentric coordinate conversion routine, and its inverse. For some bodies, such as artificial satellites the geocentric coordinates will be easier to deal with.
You can use the astro-phys api to get a JSON formatted state vector for all the planets. It calculates them using JPL's de406 so it's pretty accurate and uses the solar system barycenter.
Although, if you know where the sun is relative to the earth and you're in a geocentric model, you can subtract the position of the sun from all of the bodies (including earth) to be heliocentric.