Sunday, April 05, 2020

Notes on OpenGL programming with GLUT (freeglut3)

Wanted to create something like GL_warp2mp4 extending GL_warp2Avi using ffmpeg instead of vfw. Some notes on the process.


https://github.com/hn-88/GL_warp2Avi/blob/master/AVIGenerator.cpp
image buffer is bmBits


https://github.com/hn-88/GL_warp2Avi/blob/master/NeHeGL.h
defines structs like GL_Window

https://github.com/hn-88/GL_warp2Avi/blob/master/upate.htm
contains link to source, http://www.codeproject.com/audio/avigenerator.asp

https://www.codeproject.com/Articles/34472/Video-Texture-in-OpenGL
uses OpenGL,GLUT and OpenCV to draw video as a texture.

Software manager showed that the current package needed for GLUT is freeglut3-dev

Also will need mesa-utils?
https://askubuntu.com/questions/96087/how-to-install-opengl-glut-libraries
(already installed)

Also, on error,
sudo apt-get install libxmu-dev libxi-dev

undefined reference to symbol 'glEnable'
//usr/lib/x86_64-linux-gnu/mesa/libGL.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
link order is important?
https://stackoverflow.com/questions/23729213/link-error-when-trying-to-build-a-simple-opengl-program
So,  ${GLUT_LIBRARY} in the CMakeLists.txt is not enough?
-lGL -lGLU  -lglut works!
On my system, for making a simple hello world GLUT  app,
g++ hello.c -lGL -lGLU -lglut -o hello

For Paul Bourke's code from http://paulbourke.net/miscellaneous/lens/
gcc -Wall lens.c -lm -lGL -lGLU -lglut -o lens.bin
(since C++ does not allow casts of void* to other types, not g++, but gcc.

https://stackoverflow.com/questions/42407390/g-error-invalid-conversion-from-void-to-info-fpermissive-error-inval


https://askubuntu.com/questions/527665/undefined-reference-to-symbol-expglibc-2-2-5

so added -lm for math.h
)

OCVWarp speeds - using opencv functions on Lenovo B460,
stock.webm input VP8, 596x336
45 fps without remap, or resizing,
27 fps if resizing to 1920x1080
18 fps with remap, without writing to disk
12 fps writing Xvid

GL_warp2mp4 speeds - using opengl for resizing etc
60 fps for 640x480 texture,
60 fps for 1920x1080 viewport also.
30 fps for 1920x1080 viewport w avc1 960x480 input.
But glReadPixels slows it down to 1 fps
Also, only un-resized texture is read when viewport is bigger than screen size?!

Double buffer to make it faster?
https://stackoverflow.com/questions/39821850/why-is-glreadpixels-so-slow-and-are-there-any-alternative

http://www.songho.ca/opengl/gl_pbo.html
when trying to make, gave error,
‘glGenBuffers’ was not declared in this scope
https://community.khronos.org/t/glgenbuffers-was-not-declared-in-this-scope/59283
adding this #define to the beginning of the code
#define GL_GLEXT_PROTOTYPES
and
#include "glext.h"
solved the problem.

glReadPixels slowed down pboUnpack
from 30 to 20 fps with PBO,
20 to 14 fps wo PBO
when changed from GL_BGRA to GL_BGR as needed for opencv, went down to 2 fps. So, a proper choice of PIXEL_FORMAT - GL_BGRA - and proper double buffering, should increase speeds.

frame buffer to viewport scaling etc
https://gamedev.stackexchange.com/questions/72677/how-to-make-opengl-rendering-resolution-independent-from-its-window-context-reso

Current GL_warp2mp4 works at 10 fps, but only if the viewport is smaller than screen size. Todo - do the actual warping by incorporating code from GL_warp2Avi.




Wednesday, April 01, 2020

bluetooth audio pairing on Windows 7

This post has a good explanation and possible workaround -
https://answers.microsoft.com/en-us/windows/forum/windows_7-hardware/how-to-pairconnect-bluetooth-audio-device-to/fb49798d-9fb5-451f-95fc-301f8f76942b

For one machine, googling https://www.google.com/search?q=Lenovo+b460+Bluetooth+driver+windows+7 found the driver, installed, and my bluetooth device, recognized as YET-M1, started working.
That was on 32-bit Win7.

For another machine, googling https://www.google.com/search?q=Dell+latitude+e6540+Bluetooth+driver+windows+B7 found some drivers, installed them - this was a 64-bit Win7 - but still the device is recognized, but does not connect.

Tuesday, March 31, 2020

tool for converting 360 videos to fulldome - OCVWarp and ffmpeg's v360 filter

Paul Bourke had recently announced a real-time video playback tool which can convert and play equirectangular 360 videos as fisheye videos on domes like planetariums. 

OCVWarp can currently convert equirectangular 360 videos to fisheye videos offline - fisheye videos with 180 degree field of view would be suitable for projecting in a planetarium - fulldome videos. While the field of view is fixed at 180 degrees, the direction of viewing can be changed interactively, or by setting parameters in the ini file. This tool is useful for those who have lower powered machines which cannot handle hi-res video processing in real-time, and also for Windows and Linux users.

Here are links to OCVWarp's
Source code
Linux AppImage
Windows commandline-only executable with some restrictions.

Usage notes and bare basic compile instructions are in the readme.

Some examples, using input files found using google - these are transformations from Equirectangular to 180 degree fisheye, Type=1 in the ini file.

Input -



Output with constant parameters of anglex=0 and angley=-90 -



Output with anglex being changed by pressing 'h' once every second or so -



Output with anglex changed every frame, by keeping 'h' pressed -



Recalculation of the map files is quite slow - on my machine, 1 frame per second for 1024x1024 output. But in non-interactive mode, uncompressed 1024x1024 video was being output at around 22 fps. Encoding to some other codec would probably have slowed it down to 10 fps or so, similar to what ffmpeg was doing. 

ffmpeg's newly introduced v360 filter is supposed to do similar transformations, but it's not interactive.

Note: Paul adds in the comments below that there is a way to change the transformations over time with the v360 filter.

For testing v360 filter with ffmpeg, I had to download the static build for 24th March 2020, since even the latest release did not have this functionality.   

ffmpeg's output on the left, OCVWarp on the right. The default choices for interpolation seem to favour OCVWarp for better clarity. (Click on image for a bigger view.)




ffmpeg's output -



The ffmpeg commandline used was
./ffmpeg -i stock.webm -vf v360=e:fisheye:v_fov=180:h_fov=180:yaw=-90:w=1024:h=1024 outputfovsc-90.mp4
and a nice ffmpeg tutorial is available here.

And here is a link to all my posts about OCVWarp.

Edit on 2nd April - New release, with option to change output codec.

tool for converting 360 videos to fulldome - making of OCVWarp

I'd previously posted about OCVWarpNorth. Now, OCVWarp is finally ready with Equirectangular to 180 degree Fisheye conversion of arbitrary fields of view.

The delay was due to bugs, which I finally squashed by getting a better understanding of the transformation equations using Octave.

I'd intuitively assumed that applying a rotation tranformation to Px, Py, Pz in http://paulbourke.net/dome/dualfish2sphere/diagram.pdf should do the trick for getting any field of view. But I was done in by a bug introduced fairly stupidly, when I had specified the same variables on both sides of the rotation, like
Py = cos(angleyrad) * Py - sin(angleyrad) * Pz;
Pz = sin(angleyrad) * Py + cos(angleyrad) * Pz; 
// here, Pz gets calculated with the new Py 
//instead of with the old Py - this is the bug
instead of
PyR = cos(angleyrad) * Py - sin(angleyrad) * Pz;
PzR = sin(angleyrad) * Py + cos(angleyrad) * Pz;

I'll prepare a separate post comparing OCVWarp and ffmpeg's v360 filter.

One of the interesting views obtained during the learning process with Octave - from equidist.m, after a rotation -





This image gives some idea of the interpolation going on, especially for a low-res image - the black areas are non-interpolated, etc.

While reading up to do debugging, I found the following quite useful -
and finally, of course, just doing tests in Octave. 

Friday, March 27, 2020

online mastering

An option if just a single track needs mastering and you don't have Reaper or any other tools - online free mastering via https://www.bandlab.com/mastering

Monday, March 23, 2020

creating subtitles with Aegisub

An updated version of this old post, using the powerful cross-platform tool Aegisub instead of DivXLand Media Subtitler.

  1. Create subtitles in a plain text editor, one line per subtitle, save as a .txt file.
  2. Load the video (Video -> Open video ...) and the txt file (File -> Open subtitles...) into Aegisub using the respective menu items.
  3. Open the waveform for the timing view (Audio -> Open Audio from video). I generally find the waveform view (Audio -> Waveform display) to be intuitively understandable.
  4. Inside the waveform view, left click at the beginning of the point where you want your first subtitle. A red line appears for the begin time. Move the mouse over the blue line indicating the end of the subtitle, and when the left-right arrow appears, click and drag to move the end time.


  5. Once the timing is right, commit by pressing the 'g' key.
  6. Keyboard shortcut keys make the process much faster.
    s to play the selected portion (between begin and end)
    v to move the end time more to the right
    c to move the begin time more to the left
    g to commit (writes the subtitle begin and end time, and moves to the next line)
  7. If useful, follow these tips for speeding up your work.
  8. At the end, File -> Export subtitles. Can usually leave the settings as the default, and can export as filename.srt for a common subtitle format which is accepted by youtube etc.
  9. Youtube detailed instructions for adding subtitles is under "Upload a file" section in this support page.
  10. For local playback, VLC, for example can open the subtitle file using the menu Subtitle -> Add subtitle file.


 

Tuesday, March 17, 2020

ways to export layers from Gimp

From
 
If PNG is an acceptable output format, one option is to export it as Open Raster (.ora), an open specification for layered-image files.
  1. Export Image as Open Raster (.ora)
    File -> Export As ...
    myfile.ora
  2. Open myfile.ora as an archive, with a program like file-roller or 7zip.
    On Ubuntu:
    $ file-roller myfile.ora
    
    (alternatively)
    $ unzip myfile.ora
    
    All your layers will be png images under /data, Extract them and use at will.

    Apparently Gimp 2.10 onwards, ORA support is dropped.

Wednesday, March 11, 2020

find large files in google drive

This article https://www.theverge.com/2019/3/19/18271015/google-drive-photos-storage-space-how-to-get-more has a link to google drive's (undocumented) quota feature, which lists files in order of size,

https://drive.google.com/drive/u/0/quota

Along with the search terms in gmail for attachment size, like
larger:2MB smaller:10MB
which can find emails of a particular size range, this would be useful for people to manage their google quotas.

Tuesday, March 10, 2020

PHP odbc support issue

Shared by PB - a 3-day exchange of emails with Nettigritty support for the following:


(our site) which runs on PHP 5.6.40 has x86 architecture with ODBC Library Win32
(our beta site) 
which runs on PHP 7.4.3 has x64 architecture with ODBC Library as Win32 (should have been Win64)

We request you to install either of the following options:

 

1. Win64 version of the ODBC library for PHP 7.4.3 (64 bit)

        or

2. Win32 version of the ODBC library for PHP 7.4.3 (32-bit)


We get the error odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application, SQL state IM014 in SQLConnect


PB also shared that we are using a connect-string like
$db_connection_variable = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$dbq", '', '', SQL_CUR_USE_ODBC);


and that Plesk logs for our domain show the error

odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application, SQL state IM014 in SQLConnect






Nettigritty support replied, "Please try with a DSN-less connection. You can refer the link below for an example 
https://webcheatsheet.com/php/odbc_connection.php "

PB - We tried using a DSN-less connection as referred to you in the example link (https://webcheatsheet.com/php/odbc_connection.php)
We are getting the following error in the logs of (our beta site)

Code:
//create an instance of the  ADO connection object
$conn = new COM ("ADODB.Connection")
  or die("Cannot start ADO");


Error:
PHP Fatal error: Uncaught Error: Class 'COM' not found in C:\inetpub\vhosts\path\open_connection.inc:13
Stack trace: etc
You would need COM  to be enabled in the PHP configuration



When we use the DSN connection we get the a similar error as described here

Code:
$db_connection = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};DBQ=$dbq", '', '', SQL_CUR_USE_ODBC);


Error:
PHP Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:\inetpub\vhosts\radiosai.org\httpdocs\tfd7\open_connection.inc on line 16
PHP Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application, SQL state IM014 in SQLConnect in C:\inetpub\vhosts\radiosai.org\httpdocs\tfd7\open_connection.inc on line 16

Kindly configure the system as per the suggestion provided here:

 Nettigritty - ... please find various types of connection strings for accessing Access details at https://www.connectionstrings.com/access/ and https://www.php.net/manual/en/function.odbc-connect.php


 Please note that the server already has ODBC drivers already installed and a screenshot for the same was already shared you to confirm the same. Please note.


 We recommend even switching your MS Access database to MSSQL database for better security and compatibility with newer scripts. ...


PB replied that we have already tried all the links etc. Finally, Nettigritty replied, 

we have enabled COM class for you for PHP and you could see the error for your application directly from https://beta.radiosai.org/tfd7/login.php URL itself now.

 

On checking further, we find the DSN created through Plesk is being created as 32bit only.

 

Either it is required to use the application in 32bit or we can delete and try adding the DSN directly from server under 64 bit to see if that helps. But we recommend doing the application in 32bit as creating the DSN through plesk only will be active and migrate when there is any OS upgrade at a later point of time.


Regarding installing 64-bit ODBC driver, they said, 
This is a pending feature requested to Plesk on Windows.

https://plesk.uservoice.com/forums/184549-feature-suggestions/suggestions/39056515-add-ability-to-select-64-bit-drivers-in-odbc-data

 

Presently, please share details to manually recreate your DSN on 64 bit ODBC on the server.


They manually created the system DSN, and then the connection worked for PB.

Sunday, March 08, 2020

360 videos - online and offline

A short review of what works on my phone, LG Q6. Five years ago, I had done a similar review here and an Oculus Rift mini review here.

Downloaded hi res videos don't work. Probably the hardware does not support. This includes the 4K files from youtube, 3840x2048 H.264 High Profile.

Youtube app - 1440S works, online. Can use with google cardboard etc.

VR player - does not render the downloaded 360 video as a 360 video. Simply splits into two SBS screens.

From the list at

VR gesture player - does play the downloaded 360 files as 360 video. The gesture interface is a bit tricky to navigate, and if you don't want to use the gesture interface, the interface is tiny.

VR Player FREE - this one has a relatively simple interface, has the option to change the field of view and projections. Works for the videos which the phone supports. So, in my case, downloaded 1440S files don't work, but downloaded 720S files work.

Edit - on the Mi5, 1440S as well as 3840x2048 H.264 High Profile work fine. Even downloaded 4096x2048 video works fine. On VR Player FREE, the default settings caused the back of the screen to be blank. That is, if I turn around, I see a blank wall behind me in VR. Not sure if any setting change would give better results. Projection choices like plane, dome, fulldome etc were a bit confusing.

KMPlayer VR - the view was good on the Mi5. But the video itself did not play smoothly, was going at only a couple of frames per second or freezing.

VR Theatre for cardboard - gave excellent results for 360 video, with the settings Screen type - panoramic 360 and 3D encoding if any - Monoscopic for the 360 video I had downloaded. A good feature is that it asks for these settings for each file before playing.



Viewing the 360 video on google cardboard worked well.



On a low-cost VR-box, the view was a bit out of focus for me, and also slightly more restricted than in the cardboard viewer.



Saturday, March 07, 2020

procedure for redeeming points for flights

As of now, March 2020, this is the procedure for redeeming points for flight bookings with HDFC Regalia and Regalia First credit cards.

Go to

Click on the Privileges -> Regalia menu item.

Log in, do the flight booking, and at the end of the booking, just before the payment, option to pay with points appears. Rs. 99 is charged for generating a voucher to pay with points. Regalia First card holders can only pay 70% of the total using points. Move the slider all the way to the right (or upto 70% - in my case, all the way to the right was 70%).

Proceeding further, an email is sent with voucher code. We have to manually enter the voucher code and then make the payment with the HDFC Regalia card at the final step.

Thursday, March 05, 2020

caution when checking domainkey DKIM DNS records

I made a mistake when checking if a particular domain has DKIM records set - I just queried for TXT records on the domain, like
dig domainname.com TXT

That would return SPF records, but not domainkey DKIM records, since DKIM records can have arbitrary names, so looking at the DNS control panel is the better solution. And then can double-check when the DKIM record name is known, like
dig default._domainkey.domainname.com TXT
or
dig providername._domainkey.domainname.com TXT
and so on.

Monday, March 02, 2020

tool for converting 360 videos to fulldome for planetarium projection and Azure

Earlier, I posted about converting 360 videos to fulldome for planetarium projection using Blender. But this was excruciatingly slow. Then I worked on a tool to do a generalized warping (or remapping from one co-ordinate system to another) using OpenCV and CPU-based calculations - OCVWarp. This is still a work in progress, but some parts of it work - mapping to a 180 degree or 360 degree fisheye centred on the "North pole" of the equirectangular image is working as of now. Also with a simplified commandline-only tool to run on headless cloud servers. Meanwhile, found that ffmpeg also now has an option to do this directly, without the remap filter. Must explore the speeds etc.

On my i7 Macbook with only 4 GB RAM, output sizes greater than 2048x2048 (or maybe 3072x3072) was causing the process to run out of physical memory and start to write to swap disk. 2K output was running at around 4 fps. Tried running on an Azure VM with 16 GB RAM and on a borrowed Dell laptop with 8 GB RAM. Both of these could comfortably output 4096x4096 video at around 2 or 3 fps.

A quick note about the Azure VM. A Windows 10 VM took around 15 minutes to provision and start running. An Ubuntu 18.04 server took around 2 minutes or less.

Edit - OCVWarp has been updated. Here is a link to all my posts about OCVWarp.

Sunday, March 01, 2020

point to note for colour support with OpenCV and QHYCCD SDK

For adding colour camera support for ViewportSaver, learnt from the example code here that I had to add the crucial function which does de-bayering for QHY cameras.
SetQHYCCDDebayerOnOff(camhandle,true);

Without that, the output image was distorted, interleaved, greyscale. Further, we have to remember that OpenCV uses BGR as the colour order. So does QHY, so no issues with that. Because of this,
split(mraw, BGR);
//by default opencv puts channels in BGR order
BGR[1] = Mat::zeros(mraw.rows, mraw.cols, CV_8UC1); // green channel is set to 0
BGR[0] = Mat::zeros(mraw.rows, mraw.cols, CV_8UC1); // blue channel is set to 0
// and so on.

Saturday, February 29, 2020

Could not find module FindOpenCV.cmake

This link discusses this issue while building the project with cmake - 
https://stackoverflow.com/questions/8711109/could-not-find-module-findopencv-cmake-error-in-configuration-process

In my case, the problem was that I was setting the wrong environment variable, which is case-sensitive. Set
OpenCV_DIR, not OPENCV_DIR

Then cmake is able to find opencv.

Wednesday, February 26, 2020

remmina and RDP to Windows 10

I could not connect via RDP to the Azure Win 10 instances using the distro-supplied Remmina on Ubuntu 16.04 based Linux Mint 18.1. Found that a later version of Remmina is needed.
https://remmina.org/how-to-install-remmina/

First tried installing flatpak - that failed. Then went the ppa route, success.

Found the procedure to transfer files via RDP, by Edit connection, Share folder, and also choosing sound as local, file transfers were quite slow, 27 seconds for 7 MB in my case - 4 seconds per MB. For me, with Azure, it was faster to use wetransfer.com - faster than 1 MB / sec upload at my end, 10 sec to download a 200 MB file to the Azure VM.

Timezone bug in our code

PB corrected our schedule page code which was showing Australia NSW as GMT +10 instead of +11. Copy-pasting his solution - 

The countries which have DST spanning across the years have this issue. (Found 4 such countries) ...

I have set the dstStartMonth to January of this year as a temporary solution. ...

Modified the code to add the required condition 


FROM
if(($curMonth > $dstStartMonth && $curMonth < $dstEndMonth) ||
($curMonth == $dstStartMonth && $curDay >= $dstStartDay) ||
($curMonth == $dstEndMonth && $curDay <= $dstEndDay))
$offsetGmt= $offsetDst;
TO
if(($curMonth > $dstStartMonth && $curMonth < $dstEndMonth) ||
($curMonth < $dstStartMonth && $curMonth < $dstEndMonth &&  $dstStartMonth > $dstEndMonth) ||
($curMonth == $dstStartMonth && $curDay >= $dstStartDay) ||
($curMonth == $dstEndMonth && $curDay <= $dstEndDay))
$offsetGmt= $offsetDst;

Then restored the DST timings for the four countries.

Tuesday, February 25, 2020

enabling https for our dl domain also

The Listen Now feature, which uses playlists with http links to mp3 files, was not working on Chrome. Enabled https on our dl domain also as I'd done for our main domain, with self-signed certificates and proxying on cloudflare. Turns out I had already edited /etc/apache2/sites-enabled/ourdldomain.tld-ssl.conf

Only needed to do
a2ensite ourdldomain.tld-ssl
service apache2 reload

Once https was working for the mp3 links, the Listen Now feature started working again. 

And the workaround for the streams (which are only http at the moment) not working on Chrome might be to use the direct links to stream URLs like http://ourstream.tld:8002/ with a _target=”_blank” attribute to open them in new windows or tabs.


Thursday, February 20, 2020

a tale of two cities

This is one of my infrequent travel posts. Some earlier examples are

  1. https://hnsws.blogspot.com/2017/09/updated-budget-airline-flying-experience.html
  2. http://hnsws.blogspot.com/2007/01/flying-air-deccan.html
I'd been to Pune and Chennai recently, visiting family and also hand-carrying some items needed for our lab here. 

Both Chennai and Pune seemed to be less congested than Bangalore, the traffic jams were less severe. Also rode the Chennai Metro and was favourably impressed. Not as crowded as Bangalore's Namma Metro, since there were many more coaches - 6 vs 3 - per rake. And the interior was quieter too, during the run. The lines for token vending machines in Chennai Metro stations were relatively shorter than the lines for human assistance counters. And as expected, travelling by Metro across town was faster than travelling by car. Just half an hour to reach the airport from Annanagar, including time taken to buy tokens, wait for train, etc. 

Pune's green spaces also impressed me. Went for a couple of walks in a gated community's park and in the University campus. Apparently, some hills nearby are also preserved from tree-cutting, and offer a haven for wildlife. 

Tried out AC 1st class train travel. Comparing with AC 2-tier, the berths are somewhat wider, longer and more padded. Is it worth three times the AC 3-tier cost? Doubtful, unless you are four of a group and want the privacy of a lockable cabin. In the coach I travelled, there were 3 1st class cabins - A, B and C - occupying half of the carriage, and the other half of the bogey had AC 2 tier passengers. There were 2 toilets (one Indian, one Western) on the 1st class side, but no sink/mirror outside the toilets. Except for an initial stink when the AC was turned on, no adverse issues. Power sockets worked etc. The power sockets in the AC 2-tier cabins I travelled in for these trips also worked fine. But there was a problem with the water in the toilets running out for the Pune-Bangalore train. 

I also had my first flying experience with low-cost carrier Indigo, Chennai - Bangalore. It was an A320, VT-IZZ according to flightradar24, less than one year old. Favourably impressed by aircraft cleanliness, crew and on-time performance. They ask passengers to be at the gate 25 minutes before departure, so that everyone gets on quickly, and they have the freedom to push back early. In this case, "flying conditions at Bangalore airport" delayed the push back from 1 pm till 1.25 pm, but still reached BLR before the scheduled 2 pm since flying time was only 30 minutes and not the scheduled 1 hour. Probably the "flying conditions" were strong crosswinds. Even when we landed, the windsock was blowing right across the landing path. Boarding at Chennai used an airbridge, while de-boarding at BLR was on the tarmac, followed by a 10 minute bus ride to the terminal. This air ticket was only 30% in cash, rest in points using HDFC SmartBuy. So, I paid only around Rs. 500 out of pocket.



While at Chennai airport, I also had my first airport lounge visit, complimentary with my credit card. Access to the Travel Club lounge seemed to be only via a couple of lifts, which were quite busy. The restrooms were located outside the lounge, and hand wash was available only in the restrooms (!) so after you eat something, you have to go out and come back. But the lady in the reception desk doesn't say anything, in fact, she was the one who guided me to the restrooms outside. At 11.30 am, there were some breakfast items like idli and salads, and also aloo paratha with rajma which was my choice. A nice apron view, aircon and a place to eat. A bit cramped, so at busy times may get very crowded. 



 


build issues with appveyor

The working appveyor yml file is at
https://github.com/hn-88/ViewportSavercWin64/blob/master/appveyor.yml

The post-build artifact (exe file) can be downloaded from the Appveyor site due to the addition of the last "artifacts" section in the yml file.

The build issues were probably due to missing the OpenCV.props in some build configurations in
https://github.com/hn-88/ViewportSavercWin64/blob/master/ViewportSaverc.vcxproj

For example, line 72 has
<Import Project="qhy.props" />
<Import Project="OpenCV.props" />
while line 77 only has
<Import Project="qhy.props" />
 


building Windows binaries on the cloud - AppVeyor instead of Azure

Instead of relying on a virtual machine which will expire in 60 days, explored other solutions like an Azure free trial (one year) virtual machine. I wanted to try a build with VS2015, since the OpenCV build which I have used and is known to be working was built with an older VS than the current VS2019. Also the current VS2019 had other build issues. But when I tried an Azure VM with a VS2015 image, I got the platform image not found error as in this page,
https://medium.com/@rafique82.ai/azure-virtual-machine-visual-studio-platform-image-not-found-4234fe058317

Instead of trying to troubleshoot this, since this is available only for a year, thought of CI tools like Travis, but for Windows. Googling found that AppVeyor was more stable for Windows CI.

Googling the docs and support forums, finally got a project using QHY camera SDK and OpenCV to build - the appveyor.yml gives the detailed syntax.
https://github.com/hn-88/ViewportSavercWin64/blob/master/appveyor.yml.

I also needed to tweak the paths in the project file, in this case set using a property page qhy.props, to match the values set in the yml file. 

Wednesday, February 19, 2020

deployment issue for Visual Studio VM image in Azure

This post on Medium gives the solution for Platform Image Not Found error on Azure. Basically this is a bug in Azure deployment, I guess. 

In short, download the resource template using "Download a template for automation" from our failed VM, search for the value which gives the error. Then run inside cloud shell:
az vm image list --all --sku vs-2019-comm-latest-win10-n
(or whichever image was giving the error.)

In the case of the medium post above, it was the version which had the error. Once the template was corrected and it was redeployed, the error was not seen. 

Tuesday, February 11, 2020

using Visual Studio on Windows 10 virtualbox image

  1. Visual Studio 2019 Community edition - 20 GB download from Microsoft.
  2. On my system, 45 minutes to unzip the file, since I was using a 3 TB USB external drive which was not very fast. 
  3. Then 45 minutes to import the OVA file into virtualbox.
  4. More downloads and installs - the default Visual Studio 2019 does not have the 'develop for desktop' SDK and tools needed for C++ console apps - 45 minutes more.
  5. Spent quite a while troubleshooting why the shared folders were not visible in Win10 - turns out that sharing and discovery is turned off by default, have to enable them in Network and Sharing from the control panel.
  6. Finally it turns out that projects which need earlier versions of the toolkit - like Spinnaker SDK which needs the VS2015 toolkit - won't work, complaining that the required SDK is not found. Even downloading the oldest available SDK shown for install doesn't solve the problem. Further, lots of errors with QHYCCD SDK, like
    1>J:\qhy\include\stdint_windows.h(28,1): error C2144: syntax error: 'signed char' should be preceded by ';'
    1>J:\qhy\include\stdint_windows.h(28,21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>J:\qhy\include\stdint_windows.h(70,26): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>J:\qhy\include\stdint_windows.h(70,19): error C2146: syntax error: missing ';' before identifier 'int64_t'
    1>J:\qhy\include\stdint_windows.h(71,28): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
  7. So now I'm trying the VS2015 DVD download, which is another 7.1 GB, 90 minutes. 
  8. Edit - update - 45 minutes to uninstall VS 2019. 
  9. Three hours forty-five minutes !! to install VS2015 from virtual DVD drive in virtualbox.
  10. Then the projects compiled without too much trouble, as "Win32 console project" though I was compiling it for an x64 Release target. Will probably upload the project and solution files, along with the property pages which I created, to the github repo.
  11. Just like Windows on underpowered machines, the virtualbox Win10 takes around 2 minutes to boot, around a minute to shut down, around 5 seconds after a click in order to start opening an app, and so on. On my configuration, just 2 GB RAM for the virtualbox, and it runs from an external USB drive. But things do get done.

Edit - a better solution might be to build on the cloud - my later post

Monday, February 10, 2020

steps to create ebook friendly pdf file from LaTEX

Recommended pdf file was with a5 papersize, 0.5 cm margins, and 14 point doublespaced text. In order to achieve that, had to follow these,
https://www.overleaf.com/learn/latex/Questions/How_do_I_adjust_the_font_size%3F
https://tex.stackexchange.com/questions/402009/exam-with-18pt-main-font

in my case, by adding the line
\usepackage[14pt]{extsizes}

and later
\documentclass[
14pt

etc.

And afterwards, needed to resize some figures to make them fit in the smaller page size, and also make text tiny in tables to make them fit.
https://tex.stackexchange.com/questions/374757/how-to-make-font-size-small-in-a-tabular-environment

\centering
\tiny
\begin{tabular}

aborted attempt to create html / doc / rtf file from LaTEX

The recommended way to export LaTEX from overleaf to epub or such ebook formats is to create a html / doc / rtf file first. But both latex2rtf as well as htlatex failed to convert my document out of the box.

latex2rtf was easy to install with apt-get install, but it aborted the conversion with Error! Could not find <\end{refsection}>.

htlatex - gave a few errors, which were corrected by installing the required packages as below. But the final output html still had jumbled equations. Not prettily bitmapped ones. In short,

gave
which pointed to

"A command of the form ‘htlatex filename "html,word" "symbol/!" "-cvalidate"’ asks for HTML output tuned toward MicroSoft Word. Such a format, however, relies on bitmaps for mathematical formulas."

texlive-latex-base
LaTeX Error: File `etoolbox.sty' not found
sudo apt-get install texlive-latex-extra

sudo apt-get install texlive-science




sudo apt-get install texlive-fonts-recommended

Package minted Error: You must invoke LaTeX with the -shell-escape flag.




self-publishing a book

My experience with self-publishing a book, with Lambert and Notion Press.

  1. Interestingly, both experiences were quite quick and easy.
  2. Lambert charges nearly 10 times more, but do worldwide distribution. Notion Press does India-only distribution, but will do worldwide if you buy 50 author copies. Which comes to nearly the same amount of money as buying 3 copies from Lambert!
  3. Both publishers accepted the print-ready PDF from overleaf. Lambert sized the page down to fit, from US letter to 5.5 x 8.5 inches. Notion Press wanted US letter size. Notion Press cover designer was quite nice.
  4. Notion Press online sales page at notionpress.com/store/ was much more polished than Lambert's morebooks.shop
  5. Ebook publishing with Kindle Direct Publishing, or with Draft2Digital and so on - did not work, since the equations in my pdf did not convert correctly from pdf to epub / mobi with their online tools. But text only content in doc/rtf format works fine with their tools.
  6. The recommended way to create epub / mobi was via tools to convert to html or rtf first, but the tools stuttered and I did not pursue it further. Details in another post
  7. Finally just created a pdf file with A5 size, which is reasonably well formatted to read on a Kindle or other ebook reader, as detailed in another post.


Friday, February 07, 2020

multipe displays with old macbook pro, manual mode setting

On the Macbook pro with GT 330 M graphics (circa 2010?), running Ubuntu and Linux Mint - Mint could easily detect a TV which was capable of 1366x768 display connected via a VGA adapter to the mini-displayport, and could start a secondary display on it. But it could not force 1080p out of the box. Mirroring the display caused the resolution to drop to 1024x768.

Ubuntu 18.04 - the mirroring option was not visible on the Display applet. But as per this page, was able to hit Command+p and mirror. Unfortunately, the mirroring did not automatically choose a supported resolution, so display was garbled on built-in display.

On MacOS, interestingly enough, neither the TV nor an older VGA monitor could be displayed - enabling the secondary display caused the OS to crash (or at least blank the display completely).

A detailed post on how to set desired modes:
https://unix.stackexchange.com/questions/227876/how-to-set-custom-resolution-using-xrandr-when-the-resolution-is-not-available-i

Saturday, January 25, 2020

background reading for fisheye

Some background reading for fisheye - types of fisheye etc

http://www.fmwconcepts.com/imagemagick/pano2fisheye/index.php

https://en.wikipedia.org/wiki/Fisheye_lens
(stereographic preferred)

http://paulbourke.net/dome/fisheyetypes/
normal fisheyes are equidistant == linear? the default I assume.

Edit - all this finally resulted in OCVWarp -  a link to all my posts about OCVWarp.

Wednesday, January 22, 2020

converting 360 videos to fulldome for planetarium projection

Following the helpful post by 'borkia' on the Fulldome Yahoo group, I set up a project in Blender to render fulldome frames or video from 360 videos. 'borkia' had posted this explanatory image.

I had to take a few minutes to remind myself of the Blender interface, since it has been 7 years since my Blender fulldome experiments.
  • Right-click to select an object - this can be a camera also

  • Change its properties like position, rotation etc using the object tab on the Properties panel,

  • The rotation of the sphere in the screenshot above changes the up-down angle. Increasing the X angle is like tilting the camera down.

  • I saw this tutorial for getting to know how to edit nodes - what he suggested was to move the timeline up, and in place of the timeline, choose the editor type to be the Node editor. 

  • The Cycles rendering engine must be selected. The rest of the settings as per 'borkia's explanatory image. On my old model i7 Macbook Pro, 512x512 images were rendered in less than 2 seconds. 2048x2048 were taking 30 seconds per frame. So, around 1000x slower than real-time. So, a half-hour segment would take 20 days to render. I suppose it would be better to render in few-second chunks. One minute would take around 16 or 17 hours to render. 100 frames would take around 50 minutes or an hour. Cycles is capable of supporting GPU-based rendering, so it might work much faster with a NVIDIA + Mac Pro.

    Edit: OCVWarp can do much much faster - 4 frames per second or so for 2K output.

basics of Nodes in Blender

This video - Nodes 4 Noobs

Wednesday, January 15, 2020

Windows XP in virtualbox

Download a free version of Windows XP (30 day trial) from Microsoft - https://www.makeuseof.com/tag/download-windows-xp-for-free-and-legally-straight-from-microsoft-si/

WindowsXPMode_en-us.exe from https://www.microsoft.com/en-us/download/details.aspx?id=8002

Open the exe as type cab, unzip. Inside sources, xpm folder has the files we need. Unzip to folder, rename VirtualXPVHD as VirtualXP.VHD

Inside Virtualbox, create vm, Expert Mode, use existing hard disk & choose the vhd file above.

Virtualbox settings -> system, change boot order to HDD first for the XP virtual machine.

Display* - increase video ram

Network - set to Bridge

Set IP to 192.168.1.10 & google dns

Devices -> Install Guest Additions CD image

Snapshot to go back after 30 days. In Virtualbox, Machine | Take Snapshot

Devices -> Shared Folders to see host files

Right side Command ALT C for toggle scaled mode in Virtualbox.

More about virtualbox screen size - from https://askubuntu.com/questions/3205/higher-screen-resolution-in-virtualbox

(a) Settings > Video > Video Memory = 128 MB, Enable 3D acceleration = true.

(b) Install Guest Additions

(c) On Host machine, in cmd/bash, run
VBoxManage setextradata global GUI/MaxGuestResolution any 




This application has failed to start

A somewhat vague error message from Windows about "This application has failed to start". Following this page - https://www.coffeecup.com/help/articles/this-application-has-failed-to-start-because-the-application-configuration-is-incorrect-error-message/ - Reinstalling the C++ runtime environment seems to be the solution. 

Monday, January 13, 2020

6 mono waves to 5.1 AC3 using ffmpeg

Instead of using WAV to AC3 on Windows, a cross-platform solution using ffmpeg - from http://ankitshah009.blogspot.com/2015/02/useful-ffmpeg-commands.html

ffmpeg -i front_left.wav -i front_right.wav -i front_center.wav -i lfe.wav -i back_left.wav -i back_right.wav \
-filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[aout]" -map "[aout]" output.wav

So, in our case,

ffmpeg -i Eng.wav -i Hin.wav -i Tel.wav -i Eng.wav -i Eng.wav -i Tel.wav \
-filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[aout]" \
-map "[aout]"  -acodec ac3 directaudio.ac3

in a single step.