So I have currently made several different monthly calendars. Here is one for example. They range from the years of 1858 to 1944 all with every individual month in a year. What I also have is several different HTML files with titles like 18580907-18580908-website.html where 1858-09-07 is the start year-month-day and 1858-09-08 is the end year-month-day. The contents of the HTML files are not relevant as those work and are not an issue. The issue I am facing and trying to accomplish is to make the PNG calendars I have created correctly associate with the HTML files.
So the question I am asking is whether there is a way to script the calendar PNGs to image map the files to their correct days. Basically, I am trying to image map the files so that if you were to click on a particular day of a calendar, it will open the file associated with that. And as mentioned, each file does have the appropriate start/end dates in the file name. With that being said, I honestly have no clue how to go about scripting it since every monthly calendar will be different, but if anyone has an idea on how to go about doing it, it would be greatly appreciated!
Obviously measuring the size of a day on the calendar would be the start as all the boxes in the calendar have the same size. So doing something like
fnames_html <- str_subset(files, "html")
# coords <- # Get the coordinates
cat('<map name="calendar">', "\n")
for(i in 1:length(fnames_html)) {
cat(paste0('<area shape="rect" coords=', coords[i], 'href="', fnames_html[i], '">'), "\n")
}
cat('</map>')
> fnames_html[1:10]
[1] "18580907-18580908-website.html" "18580908-18580909-website.html" "18580910-18580911-website.html"
[4] "18580913-18580914-website.html" "18580914-18580915-website.html" "18580915-18580916-website.html"
[7] "18580916-18580917-website.html" "18580917-18580918-website.html" "18580920-18580921-website.html"
[10] "18580921-18580922-website.html"
after getting the coordinates is the way to go about it, but I don't know how to script the coordinates in without manually hard coding each one (but that's not feasible as there are thousands of HTML files).
Related
I am working on a data analysis project in R. In the end I need to hand in an HTML document.
I created a couple of PCA biplots using the autoplot funciton, about like this:
autoplot(pca, data = expression, x = 1, y = 2)
#pca is a prcomp element and expression is a data frame
By now, they are plotted one below the other in the HTML document. Is there a function that allows me to click through the different plots? So that only the first plot is shown and by clicking on an arrow or something, the second plot is shown in the same place? Kind of like a gallery.
The way multiple plots from the same chunk are show in an R Markdown would be even better, so you can select one specific plot by clicking on a miniature version of it
I've been looking through the internet a lot and hoped to find something from the html widgets page, but couldn't find anything after all.
I would really appreciate your help on this. Thanks :)
EDIT: I am not sure whether I am allowed to hand in a shiny applet, so being able to do it solely in the HTML would be awesome
Right, I found a way to do it that works fine for me. I used the {.tabset} argument I found at this link:
https://bookdown.org/yihui/rmarkdown-cookbook/html-tabs.html
## Results {.tabset}
### PC1-PC2 biplot
autoplot(pca, data = expression, x = 1, y = 2)
### PC1-PC3 biplot
autoplot(pca, data = expression, x = 1, y = 3)
## {-}
To use this, you have to create headers in your markdown using the # symbol. All headers that are one "level" below the one to which you added the {.tabset} argument (i.e. that have one more # symbol) will be the names of your tabs.
To close the tab section, you use the same number of # symbols you used in the header behind which you wrote the {.tabset} argument and write {-}.
I have lately been working on Forge Reality Capture API and using simple curl commands to reconstruct some scenes from images.
The process goes through smoothly but I never obtain a complete mesh.
1.I have tried increasing the number of images about 5 times ( from 20 to 100)
2.Tried both the obj and rcm formats ( my scenetype=object)
3.I investigated the camera positions after exporting the rcm mesh to Recap photo and only about 15 positions are shown. While I used about 100 frames in several positions. Only the images from these camera positions are stiched and get an incomplete mesh.
Is this a algorithm issue in the reconstruction?
Do I have to capture more pictures? The area is relatively small, a corridor of 50m*20m.
Can I re-process the same scene by adding additional photos?
Is there a necessity for some amount of texture?
I am grateful for the answers.
Cheers!
I suggest having a look at my blog post on Reality Capture API https://forge.autodesk.com/blog/hitchhikers-guide-reality-capture-api that might help you to debug and identify the source of the problems.
The source of the problem could range from object having transparent or reflective surfaces, to your images (or some of them) not being properly uploaded.
In general, if you don't get complete mesh, the best solution is to take more pictures of the missing spots, instead of more pictures of the entire object. If there are missing spots, it means that the engine could not figure out of your images how to stitch them - more images of those areas should help.
I'm creating a data infographic in Photoshop that inputs 'strengths / weaknesses' from a .csv file in Excel. The only thing I'd like to have is the bars that signal strength/weaknesses to adjust to the data in the csv (e.g. get longer/shorter).
To make it more clear-
Student test scores > .csv file > .psd graphic variables > if A1 = >80%, A1 psd graphic is bigger.
Essentially, I don't want to have to use illustrator to actually 'animate' the graphics. I'm wondering if there's an easier way to have flexible moving graphics per every different .csv data variable.
Would it be easier to just set each graphic itself as a pixel variable that changes? I'm hoping not. Solutions? Anyone have a script for something like this?
A script would be the best answer to your task, if you want to avoid a photoshop variable per pixel graphic.
I am mostly experienced with variable data using Illustrator, but I believe same can be accomplished with photoshop. In your case, variables would be wholly unnecessary, as you'll simply need a script which changes the drawing of your artwork based on CSV data. For example, you can have pixel or path layers named by column headers, and the script would draw or change the path shape according to the data. To get help with such a custom script, you may reach out in the Adobe Scripting forums.
I am developing an Windows Forms application using VB.NET that offers the user to lookup addresses on Google Maps through a Web Browser. I can also successfully show the directions between two points to the user, as well as allow the user to drag the route as he/she pleases. My question now is - is it possible for me to get the lattitude/longitude information of the route, i.e. the overview_polyline array of encoded lattitude/longitude points and save it to e.g. a text file on my computer? Or is it possible to get a list of all the addresses located both sides of the route over the entire length of the route, and then save the data to a file on my computer? I'm using HTML files to access and display the Google Maps data in the Web Browser item.
Thank you
This is actually pretty simple if your just looking for the screen coordinates.
// this probably should be in your form initialization
this.MouseClick += new MouseEventHandler(MouseClickEvent);
void MouseClickEvent(object sender, MouseEventArgs e)
{
// do whatever you need with e.Location
}
if your strictly looking for the point in the browser, you need to consider the functions
browser.PointToClient();
browser.PointToScreen();
So, this method is usable if you know exactly where your form is (easy to get its coords) and where you webbrowser control is (easy to get coords of this as well since it's just a control in your form) and then, as long as you know how many pixels from the left or right, and from the top or bottom the image will be displayed, once you get the global mouse click coords (which is easy) you can predict where it was clicked on the image.
Alternatively, there are some scarier or uglier ways to do it here...
You can use the ObjectForScripting property to embed code to do this in the webbrowser. It's ugly to say the least. MSDN has some documentation on the process here: http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.objectforscripting.aspx
Because its really ugly, maybe a better solution is to use AxWebBrowser - it's ugly too but not so scary.
In addition, I found this post of someone wanting to do it on a pdf document, and a MSFT person saying its not possible, but really what he is trying to say is that it isn't built in, even with a pdf document its still possible to predict with high to certain accuracy where it was clicked if you use the first method i described. Here is the post anyway: http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/2c41b74a-d140-4533-9009-9fcb382dcb60
However, it is possible, and there are a few ways to do it, so don't get scared from that last link I gave ya.
Also, this post may help if you want to do it in javascript:
http://www.devx.com/tips/Tip/29285
Basically, you can add an attribute on the image through methods available in the webbrowser control, you can add something like onclick="GetCoords();" so when it is clicked, the JavaScript function will get the coords, and then you can use javascript to place the values in a hidden input field (input type="hidden") which you can add through the webbrowser control, or if there is one already on the page, you can use that. So, once you place the coords using javacript into that input field, you can easily grab the value in that using the webbrowser control, eg:
webbrowser1.document.getElementById("myHiddenInputField").value
That will get the value in that field, which you've set through JavaScript. Also, the "GetCoords()" function i mentioned is called SetValues() in the javascript method link i provided above (in the devx.com site) but I named it GetCoords because it makes more sense and didn't want to confuse you with the actual name they used, you can change this to any name you want of course. Here is the javascript they were using, this only gets the coords into a variable, doesn't put it into a hidden input field, we will need to do that in addition (at the end of the javascript SetValues/GetCoords function).
function SetValues()
{
var s = 'X=' + window.event.clientX + ' Y=' + window.event.clientY ;
document.getElementById('divCoord').innerText = s;
}
These guys are just saving it inside a div element, which is visible to users, but you can make the div invisible if you want to use a div field, there is no advantage or disadvantage in doing that, you would just need to set the visible property to false using javascript or css, but still, it is easier to use a hidden input field so you don't need to mess with any of that.
Let me know how you get along.
I just tried to use Google Map Buddy to get satellite image from Google Map. This application first download small images from google map and then stick them together into new image. I had to wait about 2 hours to get images download my computer and it looks like it downloaded all images (22,194 images) but then the app told me that it cannot stick them together. When I started app again I though this app will reuse images on my comp but it start downloading them again. So I had to stop the process and ask you, guys, if you know how I can put that puzzle together.
The naming pattern of those images goes like this:
x=92651y=48130zoom=17.png
x=92652y=48130zoom=17.png
x=92653y=48130zoom=17.png
x=92654y=48130zoom=17.png
x=92655y=48130zoom=17.png
...
...
x=92664y=48131zoom=17.png
x=92665y=48131zoom=17.png
x=92666y=48131zoom=17.png
x=92667y=48131zoom=17.png
...
...
x=92689y=48132zoom=17.png
x=92690y=48132zoom=17.png
x=92691y=48132zoom=17.png
x=92692y=48132zoom=17.png
x=92693y=48132zoom=17.png
What can I do to stick them together programmatically using some simple scripting language? I have access to Mac and Windows systems and may be can install any simple scripting languages.
Thanks
You could use Python with Python Imaging Library (PIL).
First I'd make a list of filename and their coordinates. Extract the integer coordinates from the filenames with regular expressions and store them in a list of dictionaries:
>>> filename = 'x=92664y=48131zoom=17.png'
>>> imagePattern = re.compile(r'^x=(\d{5})y=(\d{5})zoom=17.png$')
>>> x,y = map(int, imagePattern.search(filename).groups())
>>> {'x':x, 'y':y, 'filename':filename}
{'y': 48131, 'x': 92664, 'filename': 'x=92664y=48131zoom=17.png'}
Having a list of dictionaries enables you to sort them according to either dimensions:
tileListSortedByX = sorted(tileList, key = lambda i: i["x"])
and also filter them:
fileListWhereX48131 = [tile for tile in tileList if tile["x"]==48131]
With these two operations you can easily imagine the for loops to iterate over tiles line by line.
The last thing you need to create a big empty image (with PIL) where you'll paste the small tile images into. Its size will be a multiple of the tile size.
>>> from PIL import Image
>>> bigImage = Image.new('RGB',(300,300),(255,255,255))
#creates a white 300x300 image
Pasting the small images into the big one looks like this:
>>> smallImage = Image.open(tile["filename"])
>>> bigImage.paste(smallImage,(0,0))
Hope you get the idea.
The process of "sticking images together" is usually called "stitching" or "mosaicing".
I found a list of many applications that do this on Wikipedia article - "Comparison of Photo Stitching Applications".
Edited: removed link to single app I found and replaced with wikipedia list of software.