unibas-gravis / basel-face-model-viewer

Simple Viewer for the Basel Face Model 2017
Apache License 2.0
174 stars 32 forks source link

ply export #7

Closed ImageSynthTue closed 6 years ago

ImageSynthTue commented 6 years ago

As discussed in the goolge group i'd like to share this little feature to export the face-instance as a ply-file.

BernhardEgger commented 6 years ago

Thank you a lot - I like the new functionality! I can't change your pull-request (or do a pull request in your repository). There are some unnecessary imports and I would prefer if the text on the button would say "export PLY"

those imports are sufficient:

package faces.apps

import java.awt.Dimension
import java.io.File
import javax.swing._
import javax.swing.event.{ChangeEvent, ChangeListener}

import breeze.linalg.min
import scalismo.faces.gui.{GUIBlock, GUIFrame, ImagePanel}
import scalismo.faces.gui.GUIBlock._
import scalismo.faces.parameters.RenderParameter
import scalismo.faces.io.RenderParameterIO
import scalismo.faces.sampling.face.MoMoRenderer
import scalismo.faces.color.RGB
import scalismo.faces.image.PixelImage
import scalismo.faces.io.MoMoIO
import scalismo.utils.Random

import scalismo.faces.io.MeshIO
import scalismo.faces.color.RGBA

import scala.reflect.io.Path

and that would be the changed button: val exportShapeButton = GUIBlock.button("export PLY", {

Would be nice if you could update the PR if you agree on this.

I tried updating to the newest scalismo-faces - did not solve the clamping issue - I'll do a PR there.

BernhardEgger commented 6 years ago

We fixed the issue with the written PLY files. Color channels are now clamped properly before writing the files out. To use this change in build.sbt:

libraryDependencies += "ch.unibas.cs.gravis" %% "scalismo-faces" % "0.9.2+"

The only thing that has to be changed afterwards is removing the new in front of the Random

If you could do those changes - perfect. Otherwise we will merge and do those changes afterwards. I think after this pull request we should also release a new version 1.2 of the viewer since some people might like the export functionality.

ImageSynthTue commented 6 years ago

I will implement your recommendations right away. Tanks again for your quick help regarding this matter.

BernhardEgger commented 6 years ago

Perfect Thank you a lot! I will make a new release (jar file) with the new feature!