jnatali / sagehen_meadows

Study of seasonal meadow ecohydrology in Sagehen Creek Basin.
1 stars 0 forks source link

Generate vegetation phenology time series from camera images #11

Open jnatali opened 3 months ago

jnatali commented 3 months ago

Phenocam Vegetation Time Series

Goal: Develop and analyse phenology curve data sets based on time-lapse imagery from field-mounted cameras, known as “phenocams”. In Sagehen basin, 6 phenocams were deployed in 2018, 8 in 2019, 10 in 2021 and 2024.

Deliverables:

Phenopix Considerations

2018 Phenocam Sites

sageeast-1 sageeast-2 sagekiln-1 sagekiln-2 sageup-1 sageup-2 (missing files) sagelo-1 (wrong datestamp on files after 08/25) sagelo-2

Phenocam image files

Located on Google Drive: https://drive.google.com/drive/folders/10P6tmRPVmY4LC_h-BAYol38xEKynZKWt?usp=drive_link

jnatali commented 3 months ago

2024 0702 Getting Started with Phenopix

About Git:

Phenopix Docs

https://cran.r-project.org/web/packages/phenopix/phenopix.pdf

jnatali commented 2 months ago

@ShiraGold12 For testing the ROI drawing, I'm excited to try the updated Sagehen_Phenocam.R from your branch! Got it loaded, hit a snag. I think I need to put a .jpg file of a camera reference photos somewhere. Maybe in REF?

What image are you using? If we're starting with Sageeast-1 2018 photos, I guess I can use any of the photos from that camera and that year. Or maybe there's an optimal one to define ROI...which I can find.

ShiraGold12 commented 2 months ago

@jnatali I'm using the Sageeast-1 2018 photos! When I hit the draw roi pop-up screen, it uses the first one in that folder (2018_05_16_1323.jpg). Does that work for defining ROI? Trying to figure out the extract VIs part now.

jnatali commented 2 months ago

@ShiraGold12 And you put the .jpgs in the REF folder?

ShiraGold12 commented 2 months ago

@jnatali I accidentally downloaded the images to a different folder on my desktop instead of GitHub. I'm uploading all the "RENAMED" photos to the REF folder now, but it won't let me do more than 100 at a time, and the .zip file is too big.

ShiraGold12 commented 2 months ago

@jnatali I'm definitely doing it the hard way and it stopped me after 1,000 files... I'm not sure what I'm doing wrong? I thought this would be an easy fix haha. I think now I have to go through and delete all of them?

jnatali commented 2 months ago

@ShiraGold12 Sorry to throw you off...mot a big deal if you leave 'em in RENAMED, I just wanted to know which folder to put the images in. If you're familiar with using command line in a terminal, that might be faster. Let me know if you wanna try.

jnatali commented 2 months ago

@ShiraGold12 Got the images in REF, Got the ROI window to open and could draw ROI 1. Something! The ROI window opened in my RStudio "plots" window, but when I tried to close the polygon, the right click didn't work (brought up some other tool selection), so I clicked finish and that closed the polygon but then wouldn't let me continue onto ROI 2 or 3. I can keep playing with it, see if I can get it to open in a separate window that works. If you have any thoughts or tips, let me know.

ShiraGold12 commented 2 months ago

@jnatali is "RENAMED" in Github? I'm still trying to figure Github out. I'm not familiar with using command line but I would love to learn if that makes things easier.

Also, weird. I had the x11() command bring up the ROI window because it wouldn't work without it. However, that made the first ROI pop-up in that window and then the others in the "plots" window. I ran the code without x11() and it's magically working for me all in the "plots" section. I got it to draw 3 ROIS, updating now! Let me know if it works for you

jnatali commented 2 months ago

@ShiraGold12 You can always check what's in github by going the sagehen_meadows github page, https://github.com/jnatali/sagehen_meadows

You'll be looking at the "default" branch which is main (toppish left corner dropdown button). To see your branch, dropdown and select "Shira" and then you can navigate to the folder you want to see. Such as: https://github.com/jnatali/sagehen_meadows/tree/Shira/scripts/phenocam

Instead of x11(), which I don't have installed, I tried quartz() which is for mac os. This works better, I can delineate ROIs 1-3 in a separate window (not the RStudio plot, which isn't allowing right-click). BUT it never stops the loop and keeps asking me to redelineate ROI 1, 2, 3, 1, 2, 3 forever...

I've never used R extensively, so getting used to it. Will keep at this until 5:30p or so.

And I tried to move files with command line versus the GUI...they were both really fast on my machine. It might be that you don't have much disk space on your machine. I can get you a large flash drive. If you think it'd help you now, I can drop it off tonight or tomorrow. Otherwise, can get it to you this weekend.

jnatali commented 2 months ago

@ShiraGold12 Curious what your RStudio settings are for Graphics. If you goto Tools >> Global Options >> General >> Graphics. What's listed next to "Backend"? If I have it set to Quartz, I can use the ESC key instead of right-click. BUT I'm still getting the never-ending ROI loop asking me to re-do 1,2,3,1,2,3. And then everything's stuck, I can't load the ROI db.

Sounds like you're not having this problem. I've got the latest version of RStudio, maybe the different versions behave differently. I'm going through the DrawMULTIROI_Wrapper to see if I can stop the infinite loop. Also tried the DrawMULTIROI from phenopix, throws different errors. Need to move on for today.

Glad you got it working! I may try on my laptop with older version of RStudio.

ShiraGold12 commented 2 months ago

@jnatali I see. I think I was just confused because I have the renamed images on my desktop within the REF folder but it's not in Github. Is that fine? Also, a flash drive would be great. I think it can wait until the weekend.

I figured out how to not loop ROI 1,2,3 again and again. After drawing the ROIs it goes to the next image in the folder to draw more. I have my setting on Quartz, using ESC. Getting closer!

I can look at it more tomorrow!

jnatali commented 2 months ago

@ShiraGold12 Yeah, we don't want the .jpg images on Github, so you're doing great! Github won't allow us to load ALL the images, they take up too much storage space. I'll get you a drive, putting on my list.

Ahh-ha, smart to realize that it's going to the next image. makes sense. So grateful for all the progress you're making, this is good stuff!

jnatali commented 2 months ago

NEXT STEPS with @ShiraGold12:

  1. Use a single base photo for one site/one yr (e.g. sageeast-1 for 2018) to draw 3 ROIs (willow, sedge, and mix herb) and then use the site's ROI to extract the VI (greenness) and plot graph for one year.
  2. Understand what is stored for the ROI and the VI extraction; use head() function, at least, or export to a csv.
  3. Draw 3 ROIs for another year for that site. Use the new year ROI to capture greenness values and plot graph for that year.....and then both years.
  4. Send Jen a script so that she can draw and save ROIs for each site. Then use the saved ROIs to process ALL sites from ALL years.
  5. Devise a way to detect if the camera has moved for any given site in any given year.
ShiraGold12 commented 2 months ago

@jnatali I keep getting stuck at the filtering data part. It seems like the ROI is saving and so is the VI data. I tried to convert the data into a .csv but I'm doing something wrong.

jnatali commented 2 months ago

@ShiraGold12 Great that the ROI and VI data are saving. Don't worry about the csv for the ROI, not a big deal, was just curious if we could do it. Let's see if we can plot the greennness (VI) for Sageeast-1 2018.

If you need me to outline the ROI for this first one, let me know -- If your code works for me, I can pull from your branch, use your code to generate the ROI and then check the .rdata file into your branch and then you can pull it. Sound reasonable?

ShiraGold12 commented 2 months ago

@jnatali I don't even know how to explain what's going wrong. I'm trying to plot the VIs but I keep getting stuck trying to filter the data (autofilter) and I don't know how/if I can get around it. It seems to be because "roi1" does not exist?