Recently I encountered some difficulties in working with LiDAR las files using open source software that make use of the liblas library. When attempting to open up the las file, the software would error out with a message complaining about "version minor out of range", as shown in the screenshot below.
After some investigation, it turned out that the file format version (at 1.4) of the las file is higher than was supported by the software. In order to solve the issue, the las file can be downgraded to a lower file format version e.g. 1.2.
To convert the las file to version 1.2, you can use the pdal utility from the open source software Point Data Abstraction Library (PDAL). After downloading and installing, you can type in the following at the Command Prompt.
C:\> pdal translate --writers.las.minor_version=2 input.las output.las
The resultant file can now be opened, e.g. using the lasinfo utility as shown below.
Monday, December 28, 2015
Monday, December 21, 2015
"No debugging symbols found" in gdb after compiling 3D Toolkit on Linux with CMake
I wanted to step through the source code as I execute the 3D Toolkit show program on Linux but the gdb debugger was unable to load debugging symbols, as shown in the screenshot below.
Previously, I compiled the application with the "make" command but by default, it created build instead of debug executables. So I had to enable debug compilation. In order to do that, I had to do the following:
Previously, I compiled the application with the "make" command but by default, it created build instead of debug executables. So I had to enable debug compilation. In order to do that, I had to do the following:
- Open up the 3D Toolkit's CMakeList.txt file in a text editor.
- Locate the line
set (CMAKE_BUILD_TYPE "" CACHE INTERNAL "" FORCE) - Change the above line to the following:
set (CMAKE_BUILD_TYPE "Debug") - Now recompile the application.
Now, the debugger gdb should be able to load the debug symbols and the source code can be stepped through, as shown below.
Monday, December 14, 2015
Android code snippet to create transparent bitmaps
To reduce the storage needed on a phone for images, I wanted to use a single image file and programmatically set the transparency based on some attribute, e.g. age. The Android BitmapDrawable class has a setAlpha method but it does not work as expected and the resultant icons displayed in views remain as opaque as the original because of how Android handles image resources to minimise resource usage. Eventually, I found a workaround by drawing the icon onto a canvas with the desired transparency, then creating a new icon from the canvas. The following code snippet shows how.
By using this code snippet, I was able to change the transparency of an icon image as shown in the screenshot below.
private static Bitmap makeTransparentBitmap(Bitmap bmp, int alpha) { Bitmap transBmp = Bitmap.createBitmap(bmp.getWidth(), bmp.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(transBmp); final Paint paint = new Paint(); paint.setAlpha(alpha); canvas.drawBitmap(bmp, 0, 0, paint); return transBmp; }
By using this code snippet, I was able to change the transparency of an icon image as shown in the screenshot below.
Monday, December 7, 2015
How to add many bar button items to the IOS toolbar in Xcode
This is probably something IOS development newbies might encounter while designing an IOS app graphical interface. By default, when adding a Toolbar to the main storyboard, a single bar button is included as shown below.
I wanted to add more bar button items to the toolbar; and I look high and low for a way in the property panes on the right of Xcode. Eventually, I figured that the bar button items need to be dragged from the Object library and dropped onto the toolbar on the main storyboard, as shown in the screenshot below.
The screenshot below shows three bar button items on the toolbar.
I wanted to add more bar button items to the toolbar; and I look high and low for a way in the property panes on the right of Xcode. Eventually, I figured that the bar button items need to be dragged from the Object library and dropped onto the toolbar on the main storyboard, as shown in the screenshot below.
The screenshot below shows three bar button items on the toolbar.