Converting a .fig file to a .obj file in MATLAB - file

I have a 3D plot in MATLAB, a .fig file, that I need to export as a .obj file so that I can manipulate it in a graphic design program. The program needs to have the file as x y z coordinates so a .dxf file would also work. Has anyone ever had to do something like this? I admit I'm not that experienced using MATLAB but would appreciate any suggestions.

There is a "saveobjmesh" function available that might do what you need:
http://www.nada.kth.se/~asa/Ray/matlabobj.html
The web page has got examples of how to use it.

Related

adding multiple executables C-Lion

im pretty new in C-programming. I use CLion from JetBrains to program my stuff. I would like to know how to add multiple c files in the makelist.
i would like to just open a program and to execute it..if its possible
my ide works just for one file. so i always have to change the name of the c. file in the makelist
i have already tried a lot of combinations of the makelists file but nothing worked.
does somebody have an idea how to fix this problem?
I have edit two new pictures
In this example I have two c files which i would like to execute.
My goal is to add the whole c file tree on the left side to the CMakeList
Here are the pictures
!enter image description here
Here is the error log
enter image description here
Here is the solution. Thanks to your response someprogramerdude
I just added executables and i changed the project in the beginning. the reason why i use picture is that you can see the source files on the left side
enter image description here

How can I get a `Makeheaders` binary for Windows?

I'm tired of seperately having to generate a declaration in the header file for most of the functions I'm defining in my C file. Hence, I would like to automatize this.
I've found an ideal application for this: Makeheaders
Unfortunately only the sources seem to be available, no readymade binary.
Documentation: https://www.fossil-scm.org/xfer/doc/trunk/src/makeheaders.html
Code: https://code.launchpad.net/~lockal/makeheaders/head
Does someone know where to get a binary? Would it be hard to somehow build it myself?
You can download the source code from here. It is a single makeheaders.c file.
then you just need to call cl.exe makeheaders.c it will generate a makeheaders.exe that you can use.

How do you turn a .png file into a 2-d matrix?

I am working on a project for a Bio-medical Imaging course (Note: it is a non-programming course, so asking for programming help is not cheating. Asking for conceptual help with planning would be cheating.) where I need to manipulate an image using different mathematical transforms. I am writing in C so it can be as fast as possible. I have finished the code for the mathematical transforms, but I have realized that I do not know how to turn a grayscale .png file into a 2-d matrix/array to compute with, and I do not know how to display a .png file in C. Can anyone help me?
I'm trying to turn the "image.png" image into a 2d array where each entry in the array has a value between 0 - 255 and corresponds with each pixel in "image.png". I also want to turn a 2d array where each entry corresponds to a pixel in the image and has a value between 0 - 255 into a new "image_two.png" file.
I'm a somewhat new programmer. I have a solid base in python programming, but C is new for me. I have done a lot of research and I have found a lot of people talking about using "this library" or "that library", or also "this library", but how do I use a downloaded library in C? It's unfamiliar territory for me as a python programmer :(
I'm using Ubuntu 12.04
To reiterate:
How do you read a grayscale .png image as a 2-d array/matrix in C?
How do you display a 2-d array/matrix as a grayscale image in C?
How do you use a downloaded library in C code (specifically for the two questions above)? I found out how to use these libraries.
EDIT: I am still having trouble figuring out how to create a grayscale 2d array out of a .png file and how to make a .png file out of a grayscale 2d matrix. Can anyone else help?
You can use a more general purpose image handling library and you might find it easier to use. I recommend FreeImage http://freeimage.sourceforge.net/. See the pixel access section of the manual to get access to the pixel data. You can then work with it directly or copy it into your own matrix.
To install a library in Linux, typically you will use the package manager. For example, in Debian (this includes Ubuntu) you might do:
$ apt-cache search libpng
You'll decide which package to install based on the results of running this command and then you will run
$ sudo apt-get install <package-name>
This command will likely install png.h in a location that is already included in gcc's search path. This means that to use png.h in your program, all you have to do is include it.
#include <png.h>
Skip to chapter 3 in the libpng manual for a walkthrough on reading a png file.

save array as image, imwrite matlab

Few years ago I used this way to make black and white noise:
A=randn(300,300);
B=A*255;
C=ceil(B);
imwrite(C,'noise300.jpeg'). %% or A=rand(300,300)
Today I keep getting the following mistake:
??? Error using ==> imwrite at 457
Can't open file "noise300.jpg" for writing.
You may not have write permission.
Why can't I save an array (double) as jpeg/bmp or whatever as I did with imwrite?
Here http://www.mathworks.com/matlabcentral/answers/7864 I figured out that between matlab and windows 7 there is a conflict, but I have Vista.
If there is no way to fix imwrite for my case I will appreciate another way of making jpeg with b&w noise.
Thanx,
Dina.
The reason for Matlab error
'Error using imwrite (line 455)
Unable to open file "1.jpg" for writing. You may not have write permission.'
lies in the path of current folder. It may seem something like
'C:\Program Files\MATLAB\R2013a\bin'
It needs to be changed to some other path in D: or any other drive. It works fine there.
Thank you!

Imagettftext like C function

I need to implement a functionality similar to PHP's imagettftext function. I need to enter a text and output a bmp image based on that. I already looked at freetype but it converts character by character and is not suitable to convert the whole text to an image. I am stuck at the moment. How can I access the source code of imagettftext function or is there another library inc to do that?
OK. I solved the question. In GD library there is a function to do (but requires FreeType) that and then you can save the image in PNG format.

Resources