Archive pour 11 juillet 2008

quelques codes pour matlab et courbes 2D 3D image

xes abscisses d’un graphique ?

Les objets de type Axes ne possèdent pas de propriété permettant d’incliner les labels des repères de l’axe des abscisses d’un graphique.

Il existe néanmoins plusieurs contributions disponibles sur le File EXchange qui répondent à ce besoin :

—————

Comment mettre une étiquette à mes points ?

x=rand(3,1);
y=rand(3,1);

figure
plot(x,y,'r+');

str=num2str([1:numel(x)].','%1d'); % ATTENTION le premier argument de NUM2STR doit être un vecteur colonne
text(x+0.01,y+0.01,str) % Le décalage de 0.01 est arbitraire ici.
------------
omment tracer une ligne dont la couleur varie ?
x = rand(3,1);
y = rand(3,1);

figure
subplot(2,1,1)
plot(x,y)

subplot(2,1,2)

patch('xdata',[x;x(end:-1:1)],...
      'ydata',[y;y(end:-1:1)],...
      'facecolor','interp', ...
      'edgecolor','interp',...
      'facevertexcdata',[y;y(end:-1:1)])
-------------
omment animer le tracé d'une courbe ?
% Génération des données
th=0:0.02:10*pi;
y=sin(th);

% Création de l'objet Figure contenant les tracés
fig=figure;

% Première objet Axes  est tracée la courbe directe
subplot(2,1,1)
% Tracé de la courbe
plot(th,y,'r-')
% Ajustement des limites de l'objet Axes
xlim([min(th) max(th)])
ylim([min(y) max(y)])

% Second objet Axes  est tracée la courbe animée
subplot(2,1,2)

% Modification de la propriété DoubleBuffer de l'objet Figure pour
% éviter le clignotement de la fenêtre
% NECESSAIRE POUR TOUTE ANIMATION
set(fig,'doublebuffer','on')

% Tracé du premier point de la courbe
% et récupération de l'identifiant (handle) p de l'objet Line crée.
p=plot(th(1),y(1),'r-');
% Ajustement des limites de l'objet Axes
xlim([min(th) max(th)])
ylim([min(y) max(y)])

% On boucle sur le nombre de points à tracer. 
% On démarre à 2 puisque le premier est déjà tracé
for n=2:numel(th)

  % Ajout des points de la courbe au fur et à mesure
  % en utilisant la combinaison SET + identifiant (handle)
  set(p,'xdata',th(1:n),'ydata',y(1:n));
  % Forçage de l'affichage du tracé
  drawnow

end
-------------
Comment récupérer les valeurs de données tracées ?
Dans tous les cas, il faut utiliser la fonction FINDOBJ pour récupérer l'identifiant de l'objet dont on veut
		récupérer les données.

Pour les objets de type Line (nuage de points ou lignes), Surface ou Mesh, on récupère les propriétés XDATA, YDATA et ZDATA

Pour les objets de type Image, on récupère la propriété CDATA

Pour les objets de type Patch, on récupère, soit les propriétés XDATA, YDATA et ZDATA, soit les propriétés VERTICES et FACES


[X,Y,Z] = peaks(20)
surf(X,Y,Z);

h=findobj('type','surf');
xx=get(h,'xdata')
yy=get(h,'ydata')

zz=get(h,'zdata')
--------------------
Comment redimensionner une image ?
La première solution consiste à utiliser la fonction IMRESIZE contenue dans l'Image Processing Toolbox.

La deuxième solution utilise l'indexage des matrices. Puisqu'une
image est une matrice 2D ou 3D (RGB), il est très simple de diminuer la
taille d'une image en jouant sur l'indexage. Par exemple, pour diminuer
par deux la taille d'une image 2D, il suffit de ne conserver qu'un pixel sur deux


img=rand(150,200); % Une image 2D aléatoire
size(img)

ans =

   150   200

img=img(1:2:end,1:2:end);

size(img)

ans =

    75   100

--------Pour une image 3D (RGB), le code devient :
img=rand(150,200,3); % Une image 3D (RGB) aléatoire
size(img)

ans =

   150   200     3

img=img(1:2:end,1:2:end,:);

size(img)

ans =

    75   100     3
-----
On remarque que cette solution utilisant l'indexage se limite à des facteurs de réductions/agrandissement entier.

La troisième solution utilise les fonctions d'interpolation.

Soit INTERP2 pour diminuer par deux la taille d'une image 2D :
img = rand(150,200); % Une image 2D aléatoire
size(img)

ans =

   150   200

[c,r ] = size(img); % Récupération des 2 dimensions de l'image

[ci,ri] = meshgrid(1:2:r,1:2:c); % Génération de la grille d'interpolation

img = interp2(img,ci,ri); % Interpolation des valeurs des pixels

size(img)

ans =

    75   100

Soit INTERP3 pour diminuer par deux la taille d'une image 3D :
img = rand(150,200,3); % Une image 3D (RGB) aléatoire
 size(img)

ans =

   150   200     3

[c,r,p] = size(img); % Récupération des 3 dimensions de l'image

[ci,ri,pi] = meshgrid(1:2:r,1:2:c,1:p); % Génération de la grille d'interpolation

img = interp3(img,ci,ri,pi); % Interpolation des valeurs des pixels du plan R

size(img)

 ans =

ans =

    75   100     3

VRML of a segmented image

I have an image segmented in matlab (in the form of 3d matrix with
elements 0 and 1) and from that matrix I want to create a vrml model,
do you know the best way to do it (with or without matlab, even if
with matlab I have the virtual reality toolbox installed)!

f,v]=isosurface (3Dmatrix,0);
translated to vrml with a simple script:


[fid,errmsg] = fopen(‘mymodel.wrl’,’w+’);

—-

fprintf(fid,’ coord Coordinate {\n’);
fprintf(fid,’ point [\n’);

for i=1:size (v,1)
fprintf(fid,’%f ‘,v(i,1)/500);
fprintf(fid,’%f ‘,v(i,2)/500);
fprintf(fid,’%f ‘,v(i,3)/500);
fprintf(fid,’\n’);
end

fprintf(fid,’ ]#Point\n’);
fprintf(fid,’ }#Coordinate\n’);
fprintf(fid,’ index[\n’);

for i=1:size (f,1)
fprintf(fid,’%d ‘,f(i,1)-1);
fprintf(fid,’%d ‘,f(i,2)-1);
fprintf(fid,’%d ‘,f(i,3)-1);
fprintf(fid,’\n’);
end

fprintf(fid,’ ]#index\n’);

fclose (fid);

Will you please show some (first ten lines – max .1kB) of the result?

unfortunately 30 megabytes for a 218x218x128 image!

The wrl file is not an image, it is the geometry and lighting.
You are sending the browser (the program that runs the .wrl file

(sets of x,y,z vertex values along with the info to make them
into triangles and lights that become pixels.

http://www.web3d.org/x3d/specifications/ISO-IEC-19776-X3DEncodings-XML-ClassicVRML/

that’s too much (for both speed and memory), even because i want to
deal with much bigger matrix!

Great, we all want that.

ref: http://newsgroups.derkeiler.com/Archive/Comp/comp.lang.vrml/2007-08/msg00007.html

blender file format data

Here are links to file format specs or implementations, with particlar focus on those useful in DCC (Digital Content Creation); CAD (Computer Assisted Design); video/web animation/3d Display formats; game content formats; 2d image formats; and lastly sound formats

The most widely supported CAD formats are DXF, DWG, IGES and STEP

The most widely supported DCC formats are OBJ, LWO, 3DS, Collada

The most widely supported web 3d content formats are Shockwave, VRML, X3D, U3D

The most widely supported image formats are Adobe Photoshop, PNG, JPG, GIF

if (window.showTocToggle) { var tocShowText = « show »; var tocHideText = « hide »; showTocToggle(); }

CAD formats

DCC file formats

  • FBX API – there is not a format spec available that I can find only specs for the library/api:

WEB file formats

Motion Capture Formats

http://gl.ict.usc.edu/animWeb/humanoid/fileFormats.html

Image Formats

Vector Image Formats

Scene Description Languages

Lectures on Scene Description languages http://www.cs.utah.edu/classes/cs6620/lecture-2005-01-28-6up.pdf http://www.cs.utah.edu/classes/cs6620/lecture-2005-01-28.pdf

PPM Format Specification http://netpbm.sourceforge.net/doc/ppm.html

Neutral File Format http://www.acm.org/pubs/tog/resources/SPD/NFF.TXT

Polygon File Format http://astronomy.swin.edu.au/%7Epbourke/geomformats/ply/

PLY Tools http://www.cc.gatech.edu/projects/large_models/ply.html

Scene Description languages
RenderMan Interface Specification https://renderman.pixar.com/products/rispec/

Radiance Scene Description language http://radsite.lbl.gov/radiance/refer/Notes/language_BNR.html

Manchester Scene Description language http://astronomy.swin.edu.au/~pbourke/dataformats/msdl/

POVRAY scene description language http://www.lobos.nih.gov/Charmm/Povray3/pov30019.html

YAFRAY scene description language (is there an official version somewhere??) http://download.blender.org/documentation/htmlI/ch30s03.html
Another list of format links (most of the links are broken) http://www.agocg.ac.uk/reports/virtual/36/appendix.htm

Universal translator tools

  • Polytrans – universal 3d format converter – very useful table of what formats are supported by different CAD programs, also explains the strengths and limitations of different formats http://www.okino.com/conv/filefrmt.htm

Misc lists of formats and universal importers/exporters

  • An extremely large list of formats and specs some with sample code

(note that for some of the formats he links there are much more complete specs availabled – ie lightwave lwo) http://astronomy.swin.edu.au/~pbourke/dataformats/

  • Material Exchange Format (a subset of the Advanced Authoring Format):

http://www.ebu.ch/trev_291-devlin.pdf

Useful overview of MEF http://www.digitalpreservation.gov/formats/fdd/fdd000013.shtml

HOOPS Streaming File Format spec – http://www.openhsf.org/specification/index.html

Imagine IOB – code to parse it http://www.pygott.demon.co.uk/prog.htm

Misc stuff

Poser related format data

Cell3D

http://www.3d-node.com/cmsimple-en/?Products%2C_Projects%26nbsp%3Band_Services:Cell3D

Introduction

Interactive 3D-Visualization of various microscopic image stacks.

First version was implemented in pure MS-Visual-c++ and OpenGl. The new version uses the MedWorld3D-VRML/X3D-Core. It supports all the (interactive) features of MedWorld3D and some new components especially for microscopic visualization.

Image import features (additionally to DICOM, ACR-NEMA): JPG, BMP, RAW, TIFF, PNG, JPEG2000, Biorad, Metamorph, Zeiss, Lucia, Nikon, Leica, Autooquant, Imagepro

Preparation features (additionally to MedWorld3D-features): innovative script mechanism for different filters and filter combinations for multiple ROIs.

Postprocessing features (additionally to MedWorld3D-features): 3D-Color-Manipulation, interactive chromatek 3D, object code combination

Project Status: Version 1.5 finished.

Images

Download

Interactive anatomical 3d-visualisation powered by X3D/VRML

Interactive 3D Visualization technique represents an important diagnosis and therapy planning tool. It cannot be compensated with simple 2D Pictures or static 3D Views.

Multimedia teaching tools which contain textual information, non-interactive videos and restricted pseudo three-dimensional scenarios can considerably contribute to the understanding of medical facts by the completion of interactive 3D Components. Multiuser environments are also an important aspect to recognize coherence of single events in patients physical health and to support medical teachings.

Until now, these techniques are not applicable every time and everywhere. Insufficient software functionality and quality, competitive and proprietary software and hardware as well as different system requirements for visualization aggravated the distribution of interactive 3D Systems.

So far, there is no common standard for 3D Geometry in medicine, like the Dicom files. These files include medical 2D Images, patient information and acquisition details in a special syntax.

Besides many simple 3D File formats, there are also considerably « more intelligent » specifications, like the XML compliant X3D specification. The new system reduces or eliminates all disadvantages of the regular systems and opens new Potentials.

http://www.3d-node.com/cmsimple-en/?Products%2C_Projects%26nbsp%3Band_Services:MedWorld3D

——–

Features (public Version 1.0.0)

  • 3D-Generator reads and creates 3d data from DICOM, JPG, BMP, RAW
  • VRML97/X3D compliant, tested with viper (vrml) and most known plugins on different OSs (vrml,x3d)
  • Platform-independent, uses a standard Browser Plugin (Best viewed with Cortona,BS-Contact,Freewrl or GLView, because of missing/bad/buggy script-implementation in octagonfree,flux,openvrml,venues,horizon,casa,vrweb – on those browsers only limited features)
  • Works with PocketCortona on Pdas
  • Ergonomic x3d/vrml interface, also for full windowxp-tabletpc use
  • 3D-manipulation functions like 3d-volume/area measuring and 3d-annotations in X3D/VRML. Transformation of 2D markers into 3d space and back. Export to ISO-SVG-Code.
  • Access to the real world via java-servlets
  • Multiprocessing, multimonitor and multiuser realtime experience trough EAI and SAI, limited only by the java-socket-interface and EAI availability (IE)
  • Multiuser database control for the 3d-manipulation system via java-servlets
  • Dicom-source-browsing via java-servlets (on next version also texture mapping)
  • Easy StepIn3D-system for vrml/x3d-beginners (plugin installation, tips, os-control)
  • Anatomical X3D/VRML-data-generation for all greyscale-datasets like CT,MR in dicoms/jpg/bmp-files (volume surface rendering with marching cube), interactive rendering control and annotation support with virtual sound and text enhancement -modular design, pluggable features via the 3d-generator-authoring-tool
  • Export of dicom-tags (patient,physician, institute…) to XML files for integration in X3D-scenes
  • Supports also special devices: X3D/VRML-viewer-software like 4d-vision stereo display software, phantom force-feedback-system, actual-systems holo-viewer (reduced vrml subset)
  • Special stereoscopic support and interface-design on all stereo-enabled devices (nvidia…) with e.g. cortona or glview
  • Hardware support for spaceball and spacemouse over special emulator software for all vrml/x3d viewers (windows only)
  • DirectX-device-support via bs-contact joystick interface and cortona keyboard-interface via plugin-independent joystick-emulator(partially third party, thanks to www.deinmeister.de)
  • Programmable POS-Keyboard support for cortona keyboard-nodes -plugin independent realtime image manipulation in the 2d-gui and 3d-gui(windows only, but next version comes also for linux and mac) –

3D Object Converter The program supports 524 file formats.

http://web.axelero.hu/karpo/

3D Object Converter, a powerful 3d model translation and interactive viewing shareware tool that allows arbitrary 3d model data to be imported from external sources, exported to various industry standard 3d file formats with great accuracy and quality. The program supports 524 file formats. It is available for Windows95/98/Me/NT/2K/2003/XP 32/XP 64/Vista 32/Vista 64.

STL bin asci        In/Out

PLY

OBJ

PRO/Engineer render

Qhull Mathematica

QuickDraw 3D Binary Mesh

VRML 1

VRML 2

X3D

DXF

brainVISA

Brainvoyager

3DS

IGES                       /only Out

X3D VRML freeware file translator input import export

X3D is a royalty-free open standards file format and run-time architecture to represent and communicate 3D scenes and objects using XML. It is an ISO ratified standard that provides a system for the storage, retrieval and playback of real time graphics content embedded in applications, all within an open architecture to support a wide array of domains and user scenarios.

X3D has a rich set of componentized features that can tailored for use in engineering and scientific visualization, CAD and architecture, medical visualization, training and simulation, multimedia, entertainment, education, and more.

The development of real-time communication of 3D data across all applications and network applications has evolved from its beginnings as the Virtual Reality Modeling Language (VRML) to the considerably more mature and refined X3D standard.

X3D Features at a Glance

  • XML Integrated: the key to integration with:
    • Web Services
    • Distributed Networks
    • Cross-platform, inter-application file and data transfer
  • Componentized: allows lightweight core 3D runtime delivery engine
  • Extensible: allows components to be added to extend functionality for vertical market applications and services
  • Profiled: standardized sets of extensions to meet specific application needs
  • Evolutionary: easy to update and preserve VRML97 content as X3D
  • Broadcast/Embedded Application Ready: from mobile phones to supercomputers
  • Real-Time: graphics are high quality, real-time, interactive, and include audio and video as well as 3D data.
  • Well-Specified: makes it easier to build conformant, consistent and bug-free implementations

X3D Supports

  • 3D graphics and programmable shaders – Polygonal geometry, parametric geometry, hierarchical transformations, lighting, materials, multi-pass/multi-stage texture mapping, pixel and vertex shaders, hardware acceleration
  • 2D graphics – Spatialized text; 2D vector graphics; 2D/3D compositing
  • CAD data – Translation of CAD data to an open format for publishing and interactive media
  • Animation – Timers and interpolators to drive continous animations; humanoid animation and morphing
  • Spatialized audio and video – Audio-visual sources mapped onto geometry in the scene
  • User interaction – Mouse-based picking and dragging; keyboard input
  • Navigation – Cameras; user movement within the 3D scene; collision, proximity and visibility detection
  • User-defined objects – Ability to extend built-in browser functionality by creating user-defined data types
  • Scripting – Ability to dynamically change the scene via programming and scripting languages
  • Networking – Ability to compose a single X3D scene out of assets located on a network; hyperlinking of objects to other scenes or assets located on the World Wide Web
  • Physical simulation and real-time communication – Humanoid animation; geospatial datasets; integration with Distributed Interactive Simulation (DIS) protocols

Overview of X3D Profiles and Conformance

The modular architecture of X3D allows for layered « profiles » that can provide 1) increased functionality for immersive environments and enhanced interactivity or 2) focused data interchange formats for vertical market applications within a small downloadable footprint composed of modular blocks of functionality (« Components »), that can be easily understood and implemented by application and content developers.

A component-based architecture supports creation of different « profiles » which can be individually supported. Components can be individually extended or modified through adding new « levels », or new components can be added to introduce new features, such as streaming. Through this mechanism, advancements of the specification can move quickly because development in one area doesn’t slow the specification as a whole. Importantly, the conformance requirements for a particular piece of content are unambiguosly defined by indicating the profiles, components and levels required by that content.

X3D Baseline Profiles

  • Interchange is the basic profile for communicating between applications. It support geometry, texturing, basic lighting, and animation. There is no run time model for rendering, making it very easy to use and integrate into any application.
  • Interactive enables basic interaction with a 3D environment by adding various sensor nodes for user navigation and interaction (e.g., PlanseSensor, TouchSensor, etc.), enhanced timing, and additional lighting (Spotlight, PointLight).
  • Immersive enables full 3D graphics and interaction, including audio support, collision, fog, and scripting.
  • Full includes all defined nodes including NURBS, H-Anim and GeoSpatial components.profiles

Additional X3D Profiles

  • MPEG-4 Interactive is a small footprint version of the Interactive profile designed for broadcast, handheld devices and mobile phones
  • CDF (CAD Distillation Format) is in development to enable translation of CAD data to an open format for publishing and interactive media.

X3D Content Authoring & Editing Tools
Tools for authoring X3D objects, scenes, behaviors, and character animation

X3D Viewers, Browsers & Plug-ins
X3D file and scene viewers, web browsers & viewer plug-ins

Developer Toolkits and Libraries
Tools to help developers create X3D applications and integrate X3D-support into existing applications

File Translators & Utilities
Utilities for optimizing and translating 3D data for import and/or use in X3D applications

et-Specific Applications
X3D applications that are targeted for use in specific vertical markets such as simulation, CAD, geographic mapping, medical and prototyping

X3D Collaboration Applications
X3D applications for online collaboration and communication in virtual environments.

Games, Entertainment, and Education
Games, entertainment applications, and media-rich educational applications

———-

File Translators & Utilities

3d model translation and interactive viewing shareware tool that imports X3D geometry and exports to other formats

X3D Exporter for 3D Studio Max versions 5, 6, and 7

AccuTrans 3D provides accurate translation of 3D geometry between the file formats used by many popular modeling programs. Positional and rotational information for the 3D meshes is maintained. Also many material attributes, such as color, index of refraction, reflection, specularity and Phong shading, are transferred between the files. Textures and UV coordinates are supported. The program has been enhanced with additional features to make it more than just a 3D file conversion program. It supports VRML and writing of X3D-files.

Polyhedron modelling in OFF format with conversion from OFF to VRML97 with the off2vrml program. [please include in the VRML section]

Exporter (Python-Script) which will generate an X3D-Files from Blender.

Import X3D models into the popular Blender modeling and animation package

BS Encrypt encrypts 3D models for use in commercial business applications with focus on Internet use.

BS Encrypt encrypts 3D models as content protection for use in applications with focus on Internet use or content dissemination via CD/DVD.

BS Exporter for 3ds max converts data from 3ds max and supported Extensions for BS Contact VRML/X3D for state of the art realtime and Internet ready applications.

This feature-rich exporter includes support for real-timeshadows, static radiosity lighting, dynamic particle effects, multi-texturing, normal and environment maps, movie textures, animation and custom interaction scripting from within Blender itself.

BS Reducer decreases the number of polygons in high detailed 3D models without changing the appearance.

BS Reducer decreases the number of polygons in high detailed models without changing the appearance.

A series of scripts to take BVH (Biovision) motion capture files and apply them to CAESAR human body scan files. The body parts plus the animation are combined into a complete VRML file following the H-ANIM spec plus the animation resulting in a complete H-ANIM figure animated by the BVH file.

CIS/2 are the CIMsteel Integration Standards, a common method to represent steel structures. The translator converts a CIS/2 file into a VRML or X3D file.

Translator utility to convert files in the Keyhole Markup Language (KML), the modeling format for Google Earth, into X3D

Export X3D including H-Anim from the MilkShape 3D polygon modeler

The Octaga Exporter is a very useful tool if you are a user of 3D studio max. It helps you to ease the process from design to real-time 3D presentation. It saves you a lot of time and hazel by directly exporting visual effects made in 3D studio max. The Octaga Exporter makes the work process complete from 3D studio max, to Octaga Professional, Octaga Producer to Octaga Server. Octaga Exporter is available for both 3ds Max v.5 and v.6

Okino’s PolyTrans & NuGraf provide the defacto implementations of X3D, Classic-VRML, VRML2 and VRML1 for the 3D industry. Provides bi-directional conversion between all major 3D file formats, animation systems (3ds Max, Maya, XSI, Lightwave, C4D and more), CAD file formats and VisSim systems. Robustly and accurately cross-converts meshes, trimmed NURBS, curves, 3D points, line sets, materials, textures, bitmaps, animation, and everything expected of a professional conversion system. See online help for full details. Used by 10’s of thousands of 3D professionals and Fortune 1000 companies.

Enables 3DS MAX to use SFImage data in WRL/X3D/X3DV file, include input PixelTexture to a bitmap, and output a bitmap to WRL/X3D/X3DV file.

RawKee is an open source plugin for Maya Complete and Maya Unlimited that not only allows users to export the X3D file format, but also allows them to setup X3D scripting and routing from with Maya through the RawKee X3D interaction editor.

A stand-alone application to convert the scene files exported from UnrealEd (free Unreal game editor) into X3D, including geometry, animation, sound and interactivity.

This is a standalone Java-based software package for translating VRML97 files into X3d file using « x3d-3.0.dtd ».

VrmlMerge converts VRML’97 files to X3D files (XML encoding), merges multiple .wrl files producing one big file, and replaces image textures with pixel textures.

The X3D and VRML Plugin Detector determines which, if any, X3D and VRML plugins are installed in your web browser.

Export X3D data files form the popular AC3D modeler

Xj3D includes a command-line X3D translator between XML encoding (.x3d), Classic VRML encoding (.x3dv) and VRML97 encoding (.wrl).

http://www.web3d.org/about/overview/


I MOVED THIS BLOG FROM WORDPRESS TO BLOGGER. Ce blog est à
ex-ample.blogspot.com

Blog Stats

  • 221 100 hits

localization

Flickr Photos

juillet 2008
L M M J V S D
« Juin   Août »
 123456
78910111213
14151617181920
21222324252627
28293031